Skip to content
This repository
Browse code

CoffeeScript 1.3.0

  • Loading branch information...
commit ed8d94f69ca2cf11f6bade26f1bce1a5afabd312 1 parent 1b3af68
Jeremy Ashkenas authored April 10, 2012

Showing 74 changed files with 1,588 additions and 699 deletions. Show diff stats Hide diff stats

  1. 2  LICENSE
  2. 2  documentation/coffee/block_comment.coffee
  3. 1  documentation/coffee/conditionals.coffee
  4. 3  documentation/coffee/existence.coffee
  5. 3  documentation/docs/browser.html
  6. 5  documentation/docs/cake.html
  7. 13  documentation/docs/coffee-script.html
  8. 75  documentation/docs/command.html
  9. 5  documentation/docs/grammar.html
  10. 72  documentation/docs/lexer.html
  11. 316  documentation/docs/nodes.html
  12. 62  documentation/docs/optparse.html
  13. 111  documentation/docs/repl.html
  14. 91  documentation/docs/rewriter.html
  15. 2  documentation/docs/scope.html
  16. 63  documentation/index.html.erb
  17. 21  documentation/js/aliases.js
  18. 13  documentation/js/array_comprehensions.js
  19. 4  documentation/js/block_comment.js
  20. 1  documentation/js/cake_tasks.js
  21. 13  documentation/js/classes.js
  22. 1  documentation/js/comparisons.js
  23. 7  documentation/js/conditionals.js
  24. 5  documentation/js/default_args.js
  25. 1  documentation/js/do.js
  26. 1  documentation/js/embedded.js
  27. 9  documentation/js/existence.js
  28. 1  documentation/js/expressions.js
  29. 1  documentation/js/expressions_assignment.js
  30. 1  documentation/js/expressions_comprehension.js
  31. 1  documentation/js/expressions_try.js
  32. 1  documentation/js/fat_arrow.js
  33. 1  documentation/js/functions.js
  34. 1  documentation/js/heredocs.js
  35. 1  documentation/js/heregexes.js
  36. 1  documentation/js/interpolation.js
  37. 1  documentation/js/multiple_return_values.js
  38. 1  documentation/js/object_comprehensions.js
  39. 5  documentation/js/object_extraction.js
  40. 1  documentation/js/objects_and_arrays.js
  41. 1  documentation/js/objects_reserved.js
  42. 11  documentation/js/overview.js
  43. 1  documentation/js/parallel_assignment.js
  44. 3  documentation/js/patterns_and_splats.js
  45. 1  documentation/js/prototypes.js
  46. 5  documentation/js/range_comprehensions.js
  47. 1  documentation/js/scope.js
  48. 13  documentation/js/slices.js
  49. 1  documentation/js/soaks.js
  50. 3  documentation/js/splats.js
  51. 1  documentation/js/splices.js
  52. 1  documentation/js/strings.js
  53. 1  documentation/js/switch.js
  54. 1  documentation/js/try.js
  55. 1  documentation/js/while.js
  56. 4  extras/coffee-script.js
  57. 246  index.html
  58. 30  lib/coffee-script/browser.js
  59. 22  lib/coffee-script/cake.js
  60. 28  lib/coffee-script/coffee-script.js
  61. 118  lib/coffee-script/command.js
  62. 18  lib/coffee-script/grammar.js
  63. 10  lib/coffee-script/helpers.js
  64. 2  lib/coffee-script/index.js
  65. 162  lib/coffee-script/lexer.js
  66. 507  lib/coffee-script/nodes.js
  67. 18  lib/coffee-script/optparse.js
  68. 33  lib/coffee-script/repl.js
  69. 70  lib/coffee-script/rewriter.js
  70. 38  lib/coffee-script/scope.js
  71. 2  package.json
  72. 2  src/coffee-script.coffee
  73. 12  src/nodes.coffee
  74. 1  src/repl.coffee
2  LICENSE
... ...
@@ -1,4 +1,4 @@
1  
-Copyright (c) 2011 Jeremy Ashkenas
  1
+Copyright (c) 2009-2012 Jeremy Ashkenas
2 2
 
3 3
 Permission is hereby granted, free of charge, to any person
4 4
 obtaining a copy of this software and associated documentation
2  documentation/coffee/block_comment.coffee
... ...
@@ -1,5 +1,5 @@
1 1
 ###
2  
-CoffeeScript Compiler v1.2.0
  2
+CoffeeScript Compiler v1.3.0
3 3
 Released under the MIT License
4 4
 ###
5 5
 
1  documentation/coffee/conditionals.coffee
@@ -8,6 +8,5 @@ else
8 8
 
9 9
 date = if friday then sue else jill
10 10
 
11  
-options or= defaults
12 11
 
13 12
 
3  documentation/coffee/existence.coffee
... ...
@@ -1,6 +1,7 @@
1 1
 solipsism = true if mind? and not world?
2 2
 
3  
-speed ?= 75
  3
+speed = 0
  4
+speed ?= 15
4 5
 
5 6
 footprints = yeti ? "bear"
6 7
 
3  documentation/docs/browser.html
... ...
@@ -1,5 +1,6 @@
1 1
 <!DOCTYPE html>  <html> <head>   <title>browser.coffee</title>   <meta http-equiv="content-type" content="text/html; charset=UTF-8">   <link rel="stylesheet" media="all" href="docco.css" /> </head> <body>   <div id="container">     <div id="background"></div>            <div id="jump_to">         Jump To &hellip;         <div id="jump_wrapper">           <div id="jump_page">                                           <a class="source" href="browser.html">                 browser.coffee               </a>                                           <a class="source" href="cake.html">                 cake.coffee               </a>                                           <a class="source" href="coffee-script.html">                 coffee-script.coffee               </a>                                           <a class="source" href="command.html">                 command.coffee               </a>                                           <a class="source" href="grammar.html">                 grammar.coffee               </a>                                           <a class="source" href="helpers.html">                 helpers.coffee               </a>                                           <a class="source" href="index.html">                 index.coffee               </a>                                           <a class="source" href="lexer.html">                 lexer.coffee               </a>                                           <a class="source" href="nodes.html">                 nodes.coffee               </a>                                           <a class="source" href="optparse.html">                 optparse.coffee               </a>                                           <a class="source" href="repl.html">                 repl.coffee               </a>                                           <a class="source" href="rewriter.html">                 rewriter.coffee               </a>                                           <a class="source" href="scope.html">                 scope.coffee               </a>                        </div>         </div>       </div>          <table cellpadding="0" cellspacing="0">       <thead>         <tr>           <th class="docs">             <h1>               browser.coffee             </h1>           </th>           <th class="code">           </th>         </tr>       </thead>       <tbody>                               <tr id="section-1">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-1">&#182;</a>               </div>               <p>Override exported methods for non-Node.js engines.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">CoffeeScript = </span><span class="nx">require</span> <span class="s1">&#39;./coffee-script&#39;</span>
2  
-<span class="nv">CoffeeScript.require = </span><span class="nx">require</span></pre></div>             </td>           </tr>                               <tr id="section-2">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-2">&#182;</a>               </div>               <p>Use standard JavaScript <code>eval</code> to eval code.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">CoffeeScript.eval = </span><span class="nf">(code, options) -&gt;</span>
  2
+<span class="nv">CoffeeScript.require = </span><span class="nx">require</span></pre></div>             </td>           </tr>                               <tr id="section-2">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-2">&#182;</a>               </div>               <p>Use standard JavaScript <code>eval</code> to eval code.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">CoffeeScript.eval = </span><span class="nf">(code, options = {}) -&gt;</span>
  3
+  <span class="nx">options</span><span class="p">.</span><span class="nx">bare</span> <span class="o">?=</span> <span class="kc">on</span>
3 4
   <span class="nb">eval</span> <span class="nx">CoffeeScript</span><span class="p">.</span><span class="nx">compile</span> <span class="nx">code</span><span class="p">,</span> <span class="nx">options</span></pre></div>             </td>           </tr>                               <tr id="section-3">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-3">&#182;</a>               </div>               <p>Running code does not provide access to this scope.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">CoffeeScript.run = </span><span class="nf">(code, options = {}) -&gt;</span>
4 5
   <span class="nv">options.bare = </span><span class="kc">on</span>
5 6
   <span class="nb">Function</span><span class="p">(</span><span class="nx">CoffeeScript</span><span class="p">.</span><span class="nx">compile</span> <span class="nx">code</span><span class="p">,</span> <span class="nx">options</span><span class="p">)()</span></pre></div>             </td>           </tr>                               <tr id="section-4">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-4">&#182;</a>               </div>               <p>If we're not in a browser environment, we're finished with the public API.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="k">return</span> <span class="nx">unless</span> <span class="nb">window</span><span class="o">?</span></pre></div>             </td>           </tr>                               <tr id="section-5">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-5">&#182;</a>               </div>               <p>Load a remote script from the current domain via XHR.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">CoffeeScript.load = </span><span class="nf">(url, callback) -&gt;</span>
5  documentation/docs/cake.html
@@ -25,7 +25,7 @@
25 25
 original directory name, when running Cake tasks from subdirectories.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">exports.run = </span><span class="o">-&gt;</span>
26 26
   <span class="nv">global.__originalDirname = </span><span class="nx">fs</span><span class="p">.</span><span class="nx">realpathSync</span> <span class="s1">&#39;.&#39;</span>
27 27
   <span class="nx">process</span><span class="p">.</span><span class="nx">chdir</span> <span class="nx">cakefileDirectory</span> <span class="nx">__originalDirname</span>
28  
-  <span class="nv">args = </span><span class="nx">process</span><span class="p">.</span><span class="nx">argv</span><span class="p">.</span><span class="nx">slice</span> <span class="mi">2</span>
  28
+  <span class="nv">args = </span><span class="nx">process</span><span class="p">.</span><span class="nx">argv</span><span class="p">[</span><span class="mi">2</span><span class="p">..]</span>
29 29
   <span class="nx">CoffeeScript</span><span class="p">.</span><span class="nx">run</span> <span class="nx">fs</span><span class="p">.</span><span class="nx">readFileSync</span><span class="p">(</span><span class="s1">&#39;Cakefile&#39;</span><span class="p">).</span><span class="nx">toString</span><span class="p">(),</span> <span class="nv">filename: </span><span class="s1">&#39;Cakefile&#39;</span>
30 30
   <span class="nv">oparse = </span><span class="k">new</span> <span class="nx">optparse</span><span class="p">.</span><span class="nx">OptionParser</span> <span class="nx">switches</span>
31 31
   <span class="k">return</span> <span class="nx">printTasks</span><span class="p">()</span> <span class="nx">unless</span> <span class="nx">args</span><span class="p">.</span><span class="nx">length</span>
@@ -34,7 +34,8 @@
34 34
   <span class="k">catch</span> <span class="nx">e</span>
35 35
     <span class="k">return</span> <span class="nx">fatalError</span> <span class="s2">&quot;#{e}&quot;</span>
36 36
   <span class="nx">invoke</span> <span class="nx">arg</span> <span class="k">for</span> <span class="nx">arg</span> <span class="k">in</span> <span class="nx">options</span><span class="p">.</span><span class="nx">arguments</span></pre></div>             </td>           </tr>                               <tr id="section-9">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-9">&#182;</a>               </div>               <p>Display the list of Cake tasks in a format similar to <code>rake -T</code></p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">printTasks = </span><span class="o">-&gt;</span>
37  
-  <span class="nv">cakefilePath = </span><span class="nx">path</span><span class="p">.</span><span class="nx">join</span> <span class="nx">path</span><span class="p">.</span><span class="nx">relative</span><span class="p">(</span><span class="nx">__originalDirname</span><span class="p">,</span> <span class="nx">process</span><span class="p">.</span><span class="nx">cwd</span><span class="p">()),</span> <span class="s1">&#39;Cakefile&#39;</span>
  37
+  <span class="nv">relative = </span><span class="nx">path</span><span class="p">.</span><span class="nx">relative</span> <span class="o">or</span> <span class="nx">path</span><span class="p">.</span><span class="nx">resolve</span>
  38
+  <span class="nv">cakefilePath = </span><span class="nx">path</span><span class="p">.</span><span class="nx">join</span> <span class="nx">relative</span><span class="p">(</span><span class="nx">__originalDirname</span><span class="p">,</span> <span class="nx">process</span><span class="p">.</span><span class="nx">cwd</span><span class="p">()),</span> <span class="s1">&#39;Cakefile&#39;</span>
38 39
   <span class="nx">console</span><span class="p">.</span><span class="nx">log</span> <span class="s2">&quot;#{cakefilePath} defines the following tasks:\n&quot;</span>
39 40
   <span class="k">for</span> <span class="nx">name</span><span class="p">,</span> <span class="nx">task</span> <span class="k">of</span> <span class="nx">tasks</span>
40 41
     <span class="nv">spaces = </span><span class="mi">20</span> <span class="o">-</span> <span class="nx">name</span><span class="p">.</span><span class="nx">length</span>
13  documentation/docs/coffee-script.html
@@ -13,14 +13,17 @@
13 13
     <span class="nv">content = </span><span class="nx">compile</span> <span class="nx">fs</span><span class="p">.</span><span class="nx">readFileSync</span><span class="p">(</span><span class="nx">filename</span><span class="p">,</span> <span class="s1">&#39;utf8&#39;</span><span class="p">),</span> <span class="p">{</span><span class="nx">filename</span><span class="p">}</span>
14 14
     <span class="nx">module</span><span class="p">.</span><span class="nx">_compile</span> <span class="nx">content</span><span class="p">,</span> <span class="nx">filename</span>
15 15
 <span class="k">else</span> <span class="k">if</span> <span class="nx">require</span><span class="p">.</span><span class="nx">registerExtension</span>
16  
-  <span class="nx">require</span><span class="p">.</span><span class="nx">registerExtension</span> <span class="s1">&#39;.coffee&#39;</span><span class="p">,</span> <span class="nf">(content) -&gt;</span> <span class="nx">compile</span> <span class="nx">content</span></pre></div>             </td>           </tr>                               <tr id="section-3">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-3">&#182;</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;1.2.0&#39;</span></pre></div>             </td>           </tr>                               <tr id="section-4">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-4">&#182;</a>               </div>               <p>Words that cannot be used as identifiers in CoffeeScript code</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">exports.RESERVED = </span><span class="nx">RESERVED</span></pre></div>             </td>           </tr>                               <tr id="section-5">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-5">&#182;</a>               </div>               <p>Expose helpers for testing.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">exports.helpers = </span><span class="nx">require</span> <span class="s1">&#39;./helpers&#39;</span></pre></div>             </td>           </tr>                               <tr id="section-6">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-6">&#182;</a>               </div>               <p>Compile a string of CoffeeScript code to JavaScript, using the Coffee/Jison
  16
+  <span class="nx">require</span><span class="p">.</span><span class="nx">registerExtension</span> <span class="s1">&#39;.coffee&#39;</span><span class="p">,</span> <span class="nf">(content) -&gt;</span> <span class="nx">compile</span> <span class="nx">content</span></pre></div>             </td>           </tr>                               <tr id="section-3">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-3">&#182;</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;1.3.0&#39;</span></pre></div>             </td>           </tr>                               <tr id="section-4">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-4">&#182;</a>               </div>               <p>Words that cannot be used as identifiers in CoffeeScript code</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">exports.RESERVED = </span><span class="nx">RESERVED</span></pre></div>             </td>           </tr>                               <tr id="section-5">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-5">&#182;</a>               </div>               <p>Expose helpers for testing.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">exports.helpers = </span><span class="nx">require</span> <span class="s1">&#39;./helpers&#39;</span></pre></div>             </td>           </tr>                               <tr id="section-6">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-6">&#182;</a>               </div>               <p>Compile a string of CoffeeScript code to JavaScript, using the Coffee/Jison
17 17
 compiler.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">exports.compile = compile = </span><span class="nf">(code, options = {}) -&gt;</span>
18 18
   <span class="p">{</span><span class="nx">merge</span><span class="p">}</span> <span class="o">=</span> <span class="nx">exports</span><span class="p">.</span><span class="nx">helpers</span>
19 19
   <span class="k">try</span>
20  
-    <span class="p">(</span><span class="nx">parser</span><span class="p">.</span><span class="nx">parse</span> <span class="nx">lexer</span><span class="p">.</span><span class="nx">tokenize</span> <span class="nx">code</span><span class="p">).</span><span class="nx">compile</span> <span class="nx">merge</span> <span class="p">{},</span> <span class="nx">options</span>
  20
+    <span class="nv">js = </span><span class="p">(</span><span class="nx">parser</span><span class="p">.</span><span class="nx">parse</span> <span class="nx">lexer</span><span class="p">.</span><span class="nx">tokenize</span> <span class="nx">code</span><span class="p">).</span><span class="nx">compile</span> <span class="nx">options</span>
  21
+    <span class="k">return</span> <span class="nx">js</span> <span class="nx">unless</span> <span class="nx">options</span><span class="p">.</span><span class="nx">header</span>
21 22
   <span class="k">catch</span> <span class="nx">err</span>
22 23
     <span class="nv">err.message = </span><span class="s2">&quot;In #{options.filename}, #{err.message}&quot;</span> <span class="k">if</span> <span class="nx">options</span><span class="p">.</span><span class="nx">filename</span>
23  
-    <span class="k">throw</span> <span class="nx">err</span></pre></div>             </td>           </tr>                               <tr id="section-7">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-7">&#182;</a>               </div>               <p>Tokenize a string of CoffeeScript code, and return the array of tokens.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">exports.tokens = </span><span class="nf">(code, options) -&gt;</span>
  24
+    <span class="k">throw</span> <span class="nx">err</span>
  25
+  <span class="nv">header = </span><span class="s2">&quot;Generated by CoffeeScript #{@VERSION}&quot;</span>
  26
+  <span class="s2">&quot;// #{header}\n#{js}&quot;</span></pre></div>             </td>           </tr>                               <tr id="section-7">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-7">&#182;</a>               </div>               <p>Tokenize a string of CoffeeScript code, and return the array of tokens.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">exports.tokens = </span><span class="nf">(code, options) -&gt;</span>
24 27
   <span class="nx">lexer</span><span class="p">.</span><span class="nx">tokenize</span> <span class="nx">code</span><span class="p">,</span> <span class="nx">options</span></pre></div>             </td>           </tr>                               <tr id="section-8">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-8">&#182;</a>               </div>               <p>Parse a string of CoffeeScript code or an array of lexed tokens, and
25 28
 return the AST. You can then compile it by calling <code>.compile()</code> on the root,
26 29
 or traverse it by using <code>.traverseChildren()</code> with a callback.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">exports.nodes = </span><span class="nf">(source, options) -&gt;</span>
@@ -28,9 +31,9 @@
28 31
     <span class="nx">parser</span><span class="p">.</span><span class="nx">parse</span> <span class="nx">lexer</span><span class="p">.</span><span class="nx">tokenize</span> <span class="nx">source</span><span class="p">,</span> <span class="nx">options</span>
29 32
   <span class="k">else</span>
30 33
     <span class="nx">parser</span><span class="p">.</span><span class="nx">parse</span> <span class="nx">source</span></pre></div>             </td>           </tr>                               <tr id="section-9">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-9">&#182;</a>               </div>               <p>Compile and execute a string of CoffeeScript (on the server), correctly
31  
-setting <code>__filename</code>, <code>__dirname</code>, and relative <code>require()</code>.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">exports.run = </span><span class="nf">(code, options) -&gt;</span>
  34
+setting <code>__filename</code>, <code>__dirname</code>, and relative <code>require()</code>.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">exports.run = </span><span class="nf">(code, options = {}) -&gt;</span>
32 35
   <span class="nv">mainModule = </span><span class="nx">require</span><span class="p">.</span><span class="nx">main</span></pre></div>             </td>           </tr>                               <tr id="section-10">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-10">&#182;</a>               </div>               <p>Set the filename.</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">mainModule.filename = </span><span class="nx">process</span><span class="p">.</span><span class="nx">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">=</span>
33  
-      <span class="k">if</span> <span class="nx">options</span><span class="p">.</span><span class="nx">filename</span> <span class="k">then</span> <span class="nx">fs</span><span class="p">.</span><span class="nx">realpathSync</span><span class="p">(</span><span class="nx">options</span><span class="p">.</span><span class="nx">filename</span><span class="p">)</span> <span class="k">else</span> <span class="s1">&#39;.&#39;</span></pre></div>             </td>           </tr>                               <tr id="section-11">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-11">&#182;</a>               </div>               <p>Clear the module cache.</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nx">mainModule</span><span class="p">.</span><span class="nx">moduleCache</span> <span class="o">and=</span> <span class="p">{}</span></pre></div>             </td>           </tr>                               <tr id="section-12">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-12">&#182;</a>               </div>               <p>Assign paths for node_modules loading</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">mainModule.paths = </span><span class="nx">require</span><span class="p">(</span><span class="s1">&#39;module&#39;</span><span class="p">).</span><span class="nx">_nodeModulePaths</span> <span class="nx">path</span><span class="p">.</span><span class="nx">dirname</span> <span class="nx">options</span><span class="p">.</span><span class="nx">filename</span></pre></div>             </td>           </tr>                               <tr id="section-13">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-13">&#182;</a>               </div>               <p>Compile.</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="k">if</span> <span class="nx">path</span><span class="p">.</span><span class="nx">extname</span><span class="p">(</span><span class="nx">mainModule</span><span class="p">.</span><span class="nx">filename</span><span class="p">)</span> <span class="o">isnt</span> <span class="s1">&#39;.coffee&#39;</span> <span class="o">or</span> <span class="nx">require</span><span class="p">.</span><span class="nx">extensions</span>
  36
+      <span class="k">if</span> <span class="nx">options</span><span class="p">.</span><span class="nx">filename</span> <span class="k">then</span> <span class="nx">fs</span><span class="p">.</span><span class="nx">realpathSync</span><span class="p">(</span><span class="nx">options</span><span class="p">.</span><span class="nx">filename</span><span class="p">)</span> <span class="k">else</span> <span class="s1">&#39;.&#39;</span></pre></div>             </td>           </tr>                               <tr id="section-11">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-11">&#182;</a>               </div>               <p>Clear the module cache.</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nx">mainModule</span><span class="p">.</span><span class="nx">moduleCache</span> <span class="o">and=</span> <span class="p">{}</span></pre></div>             </td>           </tr>                               <tr id="section-12">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-12">&#182;</a>               </div>               <p>Assign paths for node_modules loading</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">mainModule.paths = </span><span class="nx">require</span><span class="p">(</span><span class="s1">&#39;module&#39;</span><span class="p">).</span><span class="nx">_nodeModulePaths</span> <span class="nx">path</span><span class="p">.</span><span class="nx">dirname</span> <span class="nx">fs</span><span class="p">.</span><span class="nx">realpathSync</span> <span class="nx">options</span><span class="p">.</span><span class="nx">filename</span></pre></div>             </td>           </tr>                               <tr id="section-13">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-13">&#182;</a>               </div>               <p>Compile.</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="k">if</span> <span class="nx">path</span><span class="p">.</span><span class="nx">extname</span><span class="p">(</span><span class="nx">mainModule</span><span class="p">.</span><span class="nx">filename</span><span class="p">)</span> <span class="o">isnt</span> <span class="s1">&#39;.coffee&#39;</span> <span class="o">or</span> <span class="nx">require</span><span class="p">.</span><span class="nx">extensions</span>
34 37
     <span class="nx">mainModule</span><span class="p">.</span><span class="nx">_compile</span> <span class="nx">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="nx">mainModule</span><span class="p">.</span><span class="nx">filename</span>
35 38
   <span class="k">else</span>
36 39
     <span class="nx">mainModule</span><span class="p">.</span><span class="nx">_compile</span> <span class="nx">code</span><span class="p">,</span> <span class="nx">mainModule</span><span class="p">.</span><span class="nx">filename</span></pre></div>             </td>           </tr>                               <tr id="section-14">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-14">&#182;</a>               </div>               <p>Compile and evaluate a string of CoffeeScript (in a Node.js-like environment).
75  documentation/docs/command.html
@@ -11,11 +11,13 @@
11 11
 <span class="p">{</span><span class="nx">EventEmitter</span><span class="p">}</span> <span class="o">=</span> <span class="nx">require</span> <span class="s1">&#39;events&#39;</span></pre></div>             </td>           </tr>                               <tr id="section-3">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-3">&#182;</a>               </div>               <p>Allow CoffeeScript to emit Node.js events.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nx">helpers</span><span class="p">.</span><span class="nx">extend</span> <span class="nx">CoffeeScript</span><span class="p">,</span> <span class="k">new</span> <span class="nx">EventEmitter</span>
12 12
 
13 13
 <span class="nv">printLine = </span><span class="nf">(line) -&gt;</span> <span class="nx">process</span><span class="p">.</span><span class="nx">stdout</span><span class="p">.</span><span class="nx">write</span> <span class="nx">line</span> <span class="o">+</span> <span class="s1">&#39;\n&#39;</span>
14  
-<span class="nv">printWarn = </span><span class="nf">(line) -&gt;</span> <span class="nx">process</span><span class="p">.</span><span class="nx">stderr</span><span class="p">.</span><span class="nx">write</span> <span class="nx">line</span> <span class="o">+</span> <span class="s1">&#39;\n&#39;</span></pre></div>             </td>           </tr>                               <tr id="section-4">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-4">&#182;</a>               </div>               <p>The help banner that is printed when <code>coffee</code> is called without arguments.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">BANNER = </span><span class="s1">&#39;&#39;&#39;</span>
15  
-<span class="s1">  Usage: coffee [options] path/to/script.coffee</span>
  14
+<span class="nv">printWarn = </span><span class="nf">(line) -&gt;</span> <span class="nx">process</span><span class="p">.</span><span class="nx">stderr</span><span class="p">.</span><span class="nx">write</span> <span class="nx">line</span> <span class="o">+</span> <span class="s1">&#39;\n&#39;</span>
  15
+
  16
+<span class="nv">hidden = </span><span class="nf">(file) -&gt;</span> <span class="o">/^</span><span class="err">\</span><span class="p">.</span><span class="o">|~</span><span class="nx">$</span><span class="err">/.test file</span></pre></div>             </td>           </tr>                               <tr id="section-4">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-4">&#182;</a>               </div>               <p>The help banner that is printed when <code>coffee</code> is called without arguments.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">BANNER = </span><span class="s1">&#39;&#39;&#39;</span>
  17
+<span class="s1">  Usage: coffee [options] path/to/script.coffee -- [args]</span>
16 18
 
17 19
 <span class="s1">  If called without options, `coffee` will run your script.</span>
18  
-<span class="s1">         &#39;&#39;&#39;</span></pre></div>             </td>           </tr>                               <tr id="section-5">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-5">&#182;</a>               </div>               <p>The list of all the valid option flags that <code>coffee</code> knows how to handle.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">SWITCHES = </span><span class="p">[</span>
  20
+<span class="s1">&#39;&#39;&#39;</span></pre></div>             </td>           </tr>                               <tr id="section-5">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-5">&#182;</a>               </div>               <p>The list of all the valid option flags that <code>coffee</code> knows how to handle.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">SWITCHES = </span><span class="p">[</span>
19 21
   <span class="p">[</span><span class="s1">&#39;-b&#39;</span><span class="p">,</span> <span class="s1">&#39;--bare&#39;</span><span class="p">,</span>            <span class="s1">&#39;compile without a top-level function wrapper&#39;</span><span class="p">]</span>
20 22
   <span class="p">[</span><span class="s1">&#39;-c&#39;</span><span class="p">,</span> <span class="s1">&#39;--compile&#39;</span><span class="p">,</span>         <span class="s1">&#39;compile to JavaScript and save as .js files&#39;</span><span class="p">]</span>
21 23
   <span class="p">[</span><span class="s1">&#39;-e&#39;</span><span class="p">,</span> <span class="s1">&#39;--eval&#39;</span><span class="p">,</span>            <span class="s1">&#39;pass a string from the command line as input&#39;</span><span class="p">]</span>
@@ -47,13 +49,12 @@
47 49
   <span class="nx">loadRequires</span><span class="p">()</span>                         <span class="k">if</span> <span class="nx">opts</span><span class="p">.</span><span class="nx">require</span>
48 50
   <span class="k">return</span> <span class="nx">require</span> <span class="s1">&#39;./repl&#39;</span>                <span class="k">if</span> <span class="nx">opts</span><span class="p">.</span><span class="nx">interactive</span>
49 51
   <span class="k">if</span> <span class="nx">opts</span><span class="p">.</span><span class="nx">watch</span> <span class="o">and</span> <span class="o">!</span><span class="nx">fs</span><span class="p">.</span><span class="nx">watch</span>
50  
-    <span class="nx">printWarn</span> <span class="s2">&quot;The --watch feature depends on Node v0.6.0+. You are running #{process.version}.&quot;</span>
  52
+    <span class="k">return</span> <span class="nx">printWarn</span> <span class="s2">&quot;The --watch feature depends on Node v0.6.0+. You are running #{process.version}.&quot;</span>
51 53
   <span class="k">return</span> <span class="nx">compileStdio</span><span class="p">()</span>                  <span class="k">if</span> <span class="nx">opts</span><span class="p">.</span><span class="nx">stdio</span>
52 54
   <span class="k">return</span> <span class="nx">compileScript</span> <span class="kc">null</span><span class="p">,</span> <span class="nx">sources</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>  <span class="k">if</span> <span class="nx">opts</span><span class="p">.</span><span class="nb">eval</span>
53 55
   <span class="k">return</span> <span class="nx">require</span> <span class="s1">&#39;./repl&#39;</span>                <span class="nx">unless</span> <span class="nx">sources</span><span class="p">.</span><span class="nx">length</span>
54  
-  <span class="k">if</span> <span class="nx">opts</span><span class="p">.</span><span class="nx">run</span>
55  
-    <span class="nv">opts.literals = </span><span class="nx">sources</span><span class="p">.</span><span class="nx">splice</span><span class="p">(</span><span class="mi">1</span><span class="p">).</span><span class="nx">concat</span> <span class="nx">opts</span><span class="p">.</span><span class="nx">literals</span>
56  
-  <span class="nv">process.argv = </span><span class="nx">process</span><span class="p">.</span><span class="nx">argv</span><span class="p">.</span><span class="nx">slice</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">).</span><span class="nx">concat</span> <span class="nx">opts</span><span class="p">.</span><span class="nx">literals</span>
  56
+  <span class="nv">literals = </span><span class="k">if</span> <span class="nx">opts</span><span class="p">.</span><span class="nx">run</span> <span class="k">then</span> <span class="nx">sources</span><span class="p">.</span><span class="nx">splice</span> <span class="mi">1</span> <span class="k">else</span> <span class="p">[]</span>
  57
+  <span class="nv">process.argv = </span><span class="nx">process</span><span class="p">.</span><span class="nx">argv</span><span class="p">[</span><span class="mi">0</span><span class="p">..</span><span class="mi">1</span><span class="p">].</span><span class="nx">concat</span> <span class="nx">literals</span>
57 58
   <span class="nx">process</span><span class="p">.</span><span class="nx">argv</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;coffee&#39;</span>
58 59
   <span class="nv">process.execPath = </span><span class="nx">require</span><span class="p">.</span><span class="nx">main</span><span class="p">.</span><span class="nx">filename</span>
59 60
   <span class="k">for</span> <span class="nx">source</span> <span class="k">in</span> <span class="nx">sources</span>
@@ -75,11 +76,11 @@
75 76
       <span class="nx">fs</span><span class="p">.</span><span class="nx">readdir</span> <span class="nx">source</span><span class="p">,</span> <span class="nf">(err, files) -&gt;</span>
76 77
         <span class="k">throw</span> <span class="nx">err</span> <span class="k">if</span> <span class="nx">err</span> <span class="o">and</span> <span class="nx">err</span><span class="p">.</span><span class="nx">code</span> <span class="o">isnt</span> <span class="s1">&#39;ENOENT&#39;</span>
77 78
         <span class="k">return</span> <span class="k">if</span> <span class="nx">err</span><span class="o">?</span><span class="p">.</span><span class="nx">code</span> <span class="o">is</span> <span class="s1">&#39;ENOENT&#39;</span>
78  
-        <span class="nv">files = </span><span class="nx">files</span><span class="p">.</span><span class="nx">map</span> <span class="nf">(file) -&gt;</span> <span class="nx">path</span><span class="p">.</span><span class="nx">join</span> <span class="nx">source</span><span class="p">,</span> <span class="nx">file</span>
79 79
         <span class="nv">index = </span><span class="nx">sources</span><span class="p">.</span><span class="nx">indexOf</span> <span class="nx">source</span>
80  
-        <span class="nx">sources</span><span class="p">[</span><span class="nx">index</span><span class="p">..</span><span class="nx">index</span><span class="p">]</span> <span class="o">=</span> <span class="nx">files</span>
  80
+        <span class="nx">sources</span><span class="p">[</span><span class="nx">index</span><span class="p">..</span><span class="nx">index</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="nx">path</span><span class="p">.</span><span class="nx">join</span> <span class="nx">source</span><span class="p">,</span> <span class="nx">file</span> <span class="k">for</span> <span class="nx">file</span> <span class="k">in</span> <span class="nx">files</span><span class="p">)</span>
81 81
         <span class="nx">sourceCode</span><span class="p">[</span><span class="nx">index</span><span class="p">..</span><span class="nx">index</span><span class="p">]</span> <span class="o">=</span> <span class="nx">files</span><span class="p">.</span><span class="nx">map</span> <span class="o">-&gt;</span> <span class="kc">null</span>
82  
-        <span class="nx">compilePath</span> <span class="nx">file</span><span class="p">,</span> <span class="kc">no</span><span class="p">,</span> <span class="nx">base</span> <span class="k">for</span> <span class="nx">file</span> <span class="k">in</span> <span class="nx">files</span>
  82
+        <span class="k">for</span> <span class="nx">file</span> <span class="k">in</span> <span class="nx">files</span> <span class="k">when</span> <span class="o">not</span> <span class="nx">hidden</span> <span class="nx">file</span>
  83
+          <span class="nx">compilePath</span> <span class="p">(</span><span class="nx">path</span><span class="p">.</span><span class="nx">join</span> <span class="nx">source</span><span class="p">,</span> <span class="nx">file</span><span class="p">),</span> <span class="kc">no</span><span class="p">,</span> <span class="nx">base</span>
83 84
     <span class="k">else</span> <span class="k">if</span> <span class="nx">topLevel</span> <span class="o">or</span> <span class="nx">path</span><span class="p">.</span><span class="nx">extname</span><span class="p">(</span><span class="nx">source</span><span class="p">)</span> <span class="o">is</span> <span class="s1">&#39;.coffee&#39;</span>
84 85
       <span class="nx">watch</span> <span class="nx">source</span><span class="p">,</span> <span class="nx">base</span> <span class="k">if</span> <span class="nx">opts</span><span class="p">.</span><span class="nx">watch</span>
85 86
       <span class="nx">fs</span><span class="p">.</span><span class="nx">readFile</span> <span class="nx">source</span><span class="p">,</span> <span class="nf">(err, code) -&gt;</span>
@@ -111,7 +112,7 @@
111 112
   <span class="k">catch</span> <span class="nx">err</span>
112 113
     <span class="nx">CoffeeScript</span><span class="p">.</span><span class="nx">emit</span> <span class="s1">&#39;failure&#39;</span><span class="p">,</span> <span class="nx">err</span><span class="p">,</span> <span class="nx">task</span>
113 114
     <span class="k">return</span> <span class="k">if</span> <span class="nx">CoffeeScript</span><span class="p">.</span><span class="nx">listeners</span><span class="p">(</span><span class="s1">&#39;failure&#39;</span><span class="p">).</span><span class="nx">length</span>
114  
-    <span class="k">return</span> <span class="nx">printLine</span> <span class="nx">err</span><span class="p">.</span><span class="nx">message</span> <span class="k">if</span> <span class="nx">o</span><span class="p">.</span><span class="nx">watch</span>
  115
+    <span class="k">return</span> <span class="nx">printLine</span> <span class="nx">err</span><span class="p">.</span><span class="nx">message</span> <span class="o">+</span> <span class="s1">&#39;\x07&#39;</span> <span class="k">if</span> <span class="nx">o</span><span class="p">.</span><span class="nx">watch</span>
115 116
     <span class="nx">printWarn</span> <span class="nx">err</span> <span class="k">instanceof</span> <span class="nb">Error</span> <span class="o">and</span> <span class="nx">err</span><span class="p">.</span><span class="nx">stack</span> <span class="o">or</span> <span class="s2">&quot;ERROR: #{err}&quot;</span>
116 117
     <span class="nx">process</span><span class="p">.</span><span class="nx">exit</span> <span class="mi">1</span></pre></div>             </td>           </tr>                               <tr id="section-10">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-10">&#182;</a>               </div>               <p>Attach the appropriate listeners to compile scripts incoming over <strong>stdin</strong>,
117 118
 and write them back to <strong>stdout</strong>.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">compileStdio = </span><span class="o">-&gt;</span>
@@ -141,8 +142,12 @@
141 142
   <span class="nv">watchErr = </span><span class="nf">(e) -&gt;</span>
142 143
     <span class="k">if</span> <span class="nx">e</span><span class="p">.</span><span class="nx">code</span> <span class="o">is</span> <span class="s1">&#39;ENOENT&#39;</span>
143 144
       <span class="k">return</span> <span class="k">if</span> <span class="nx">sources</span><span class="p">.</span><span class="nx">indexOf</span><span class="p">(</span><span class="nx">source</span><span class="p">)</span> <span class="o">is</span> <span class="o">-</span><span class="mi">1</span>
144  
-      <span class="nx">removeSource</span> <span class="nx">source</span><span class="p">,</span> <span class="nx">base</span><span class="p">,</span> <span class="kc">yes</span>
145  
-      <span class="nx">compileJoin</span><span class="p">()</span>
  145
+      <span class="k">try</span>
  146
+        <span class="nx">rewatch</span><span class="p">()</span>
  147
+        <span class="nx">compile</span><span class="p">()</span>
  148
+      <span class="k">catch</span> <span class="nx">e</span>
  149
+        <span class="nx">removeSource</span> <span class="nx">source</span><span class="p">,</span> <span class="nx">base</span><span class="p">,</span> <span class="kc">yes</span>
  150
+        <span class="nx">compileJoin</span><span class="p">()</span>
146 151
     <span class="k">else</span> <span class="k">throw</span> <span class="nx">e</span>
147 152
 
148 153
   <span class="nv">compile = </span><span class="o">-&gt;</span>
@@ -150,32 +155,22 @@
150 155
     <span class="nv">compileTimeout = </span><span class="nx">wait</span> <span class="mi">25</span><span class="p">,</span> <span class="o">-&gt;</span>
151 156
       <span class="nx">fs</span><span class="p">.</span><span class="nx">stat</span> <span class="nx">source</span><span class="p">,</span> <span class="nf">(err, stats) -&gt;</span>
152 157
         <span class="k">return</span> <span class="nx">watchErr</span> <span class="nx">err</span> <span class="k">if</span> <span class="nx">err</span>
153  
-        <span class="k">return</span> <span class="k">if</span> <span class="nx">prevStats</span> <span class="o">and</span> <span class="p">(</span><span class="nx">stats</span><span class="p">.</span><span class="nx">size</span> <span class="o">is</span> <span class="nx">prevStats</span><span class="p">.</span><span class="nx">size</span> <span class="o">and</span>
154  
-          <span class="nx">stats</span><span class="p">.</span><span class="nx">mtime</span><span class="p">.</span><span class="nx">getTime</span><span class="p">()</span> <span class="o">is</span> <span class="nx">prevStats</span><span class="p">.</span><span class="nx">mtime</span><span class="p">.</span><span class="nx">getTime</span><span class="p">())</span>
  158
+        <span class="k">return</span> <span class="nx">rewatch</span><span class="p">()</span> <span class="k">if</span> <span class="nx">prevStats</span> <span class="o">and</span> <span class="nx">stats</span><span class="p">.</span><span class="nx">size</span> <span class="o">is</span> <span class="nx">prevStats</span><span class="p">.</span><span class="nx">size</span> <span class="o">and</span>
  159
+          <span class="nx">stats</span><span class="p">.</span><span class="nx">mtime</span><span class="p">.</span><span class="nx">getTime</span><span class="p">()</span> <span class="o">is</span> <span class="nx">prevStats</span><span class="p">.</span><span class="nx">mtime</span><span class="p">.</span><span class="nx">getTime</span><span class="p">()</span>
155 160
         <span class="nv">prevStats = </span><span class="nx">stats</span>
156 161
         <span class="nx">fs</span><span class="p">.</span><span class="nx">readFile</span> <span class="nx">source</span><span class="p">,</span> <span class="nf">(err, code) -&gt;</span>
157 162
           <span class="k">return</span> <span class="nx">watchErr</span> <span class="nx">err</span> <span class="k">if</span> <span class="nx">err</span>
158 163
           <span class="nx">compileScript</span><span class="p">(</span><span class="nx">source</span><span class="p">,</span> <span class="nx">code</span><span class="p">.</span><span class="nx">toString</span><span class="p">(),</span> <span class="nx">base</span><span class="p">)</span>
159  
-
160  
-  <span class="nv">watchErr = </span><span class="nf">(e) -&gt;</span>
161  
-    <span class="k">throw</span> <span class="nx">e</span> <span class="nx">unless</span> <span class="nx">e</span><span class="p">.</span><span class="nx">code</span> <span class="o">is</span> <span class="s1">&#39;ENOENT&#39;</span>
162  
-    <span class="nx">removeSource</span> <span class="nx">source</span><span class="p">,</span> <span class="nx">base</span><span class="p">,</span> <span class="kc">yes</span>
163  
-    <span class="nx">compileJoin</span><span class="p">()</span>
  164
+          <span class="nx">rewatch</span><span class="p">()</span>
164 165
 
165 166
   <span class="k">try</span>
166  
-    <span class="nv">watcher = </span><span class="nx">fs</span><span class="p">.</span><span class="nx">watch</span> <span class="nx">source</span><span class="p">,</span> <span class="nv">callback = </span><span class="nf">(event) -&gt;</span>
167  
-      <span class="k">if</span> <span class="nx">event</span> <span class="o">is</span> <span class="s1">&#39;change&#39;</span>
168  
-        <span class="nx">compile</span><span class="p">()</span>
169  
-      <span class="k">else</span> <span class="k">if</span> <span class="nx">event</span> <span class="o">is</span> <span class="s1">&#39;rename&#39;</span>
170  
-        <span class="nx">watcher</span><span class="p">.</span><span class="nx">close</span><span class="p">()</span>
171  
-        <span class="nx">wait</span> <span class="mi">250</span><span class="p">,</span> <span class="o">-&gt;</span>
172  
-          <span class="nx">compile</span><span class="p">()</span>
173  
-          <span class="k">try</span>
174  
-            <span class="nv">watcher = </span><span class="nx">fs</span><span class="p">.</span><span class="nx">watch</span> <span class="nx">source</span><span class="p">,</span> <span class="nx">callback</span>
175  
-          <span class="k">catch</span> <span class="nx">e</span>  
176  
-            <span class="nx">watchErr</span> <span class="nx">e</span>
177  
-  <span class="k">catch</span> <span class="nx">e</span> 
178  
-    <span class="nx">watchErr</span> <span class="nx">e</span></pre></div>             </td>           </tr>                               <tr id="section-14">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-14">&#182;</a>               </div>               <p>Watch a directory of files for new additions.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">watchDir = </span><span class="nf">(source, base) -&gt;</span>
  167
+    <span class="nv">watcher = </span><span class="nx">fs</span><span class="p">.</span><span class="nx">watch</span> <span class="nx">source</span><span class="p">,</span> <span class="nx">compile</span>
  168
+  <span class="k">catch</span> <span class="nx">e</span>
  169
+    <span class="nx">watchErr</span> <span class="nx">e</span>
  170
+
  171
+  <span class="nv">rewatch = </span><span class="o">-&gt;</span>
  172
+    <span class="nx">watcher</span><span class="o">?</span><span class="p">.</span><span class="nx">close</span><span class="p">()</span>
  173
+    <span class="nv">watcher = </span><span class="nx">fs</span><span class="p">.</span><span class="nx">watch</span> <span class="nx">source</span><span class="p">,</span> <span class="nx">compile</span></pre></div>             </td>           </tr>                               <tr id="section-14">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-14">&#182;</a>               </div>               <p>Watch a directory of files for new additions.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">watchDir = </span><span class="nf">(source, base) -&gt;</span>
179 174
   <span class="nv">readdirTimeout = </span><span class="kc">null</span>
180 175
   <span class="k">try</span>
181 176
     <span class="nv">watcher = </span><span class="nx">fs</span><span class="p">.</span><span class="nx">watch</span> <span class="nx">source</span><span class="p">,</span> <span class="o">-&gt;</span>
@@ -186,8 +181,8 @@
186 181
             <span class="k">throw</span> <span class="nx">err</span> <span class="nx">unless</span> <span class="nx">err</span><span class="p">.</span><span class="nx">code</span> <span class="o">is</span> <span class="s1">&#39;ENOENT&#39;</span>
187 182
             <span class="nx">watcher</span><span class="p">.</span><span class="nx">close</span><span class="p">()</span>
188 183
             <span class="k">return</span> <span class="nx">unwatchDir</span> <span class="nx">source</span><span class="p">,</span> <span class="nx">base</span>
189  
-          <span class="nv">files = </span><span class="nx">files</span><span class="p">.</span><span class="nx">map</span> <span class="nf">(file) -&gt;</span> <span class="nx">path</span><span class="p">.</span><span class="nx">join</span> <span class="nx">source</span><span class="p">,</span> <span class="nx">file</span>
190  
-          <span class="k">for</span> <span class="nx">file</span> <span class="k">in</span> <span class="nx">files</span> <span class="k">when</span> <span class="o">not</span> <span class="nx">notSources</span><span class="p">[</span><span class="nx">file</span><span class="p">]</span>
  184
+          <span class="k">for</span> <span class="nx">file</span> <span class="k">in</span> <span class="nx">files</span> <span class="k">when</span> <span class="o">not</span> <span class="nx">hidden</span><span class="p">(</span><span class="nx">file</span><span class="p">)</span> <span class="o">and</span> <span class="o">not</span> <span class="nx">notSources</span><span class="p">[</span><span class="nx">file</span><span class="p">]</span>
  185
+            <span class="nv">file = </span><span class="nx">path</span><span class="p">.</span><span class="nx">join</span> <span class="nx">source</span><span class="p">,</span> <span class="nx">file</span>
191 186
             <span class="k">continue</span> <span class="k">if</span> <span class="nx">sources</span><span class="p">.</span><span class="nx">some</span> <span class="nf">(s) -&gt;</span> <span class="nx">s</span><span class="p">.</span><span class="nx">indexOf</span><span class="p">(</span><span class="nx">file</span><span class="p">)</span> <span class="o">&gt;=</span> <span class="mi">0</span>
192 187
             <span class="nx">sources</span><span class="p">.</span><span class="nx">push</span> <span class="nx">file</span>
193 188
             <span class="nx">sourceCode</span><span class="p">.</span><span class="nx">push</span> <span class="kc">null</span>
@@ -196,7 +191,7 @@
196 191
     <span class="k">throw</span> <span class="nx">e</span> <span class="nx">unless</span> <span class="nx">e</span><span class="p">.</span><span class="nx">code</span> <span class="o">is</span> <span class="s1">&#39;ENOENT&#39;</span>
197 192
 
198 193
 <span class="nv">unwatchDir = </span><span class="nf">(source, base) -&gt;</span>
199  
-  <span class="nv">prevSources = </span><span class="nx">sources</span><span class="p">.</span><span class="nx">slice</span><span class="p">()</span>
  194
+  <span class="nv">prevSources = </span><span class="nx">sources</span><span class="p">[..]</span>
200 195
   <span class="nv">toRemove = </span><span class="p">(</span><span class="nx">file</span> <span class="k">for</span> <span class="nx">file</span> <span class="k">in</span> <span class="nx">sources</span> <span class="k">when</span> <span class="nx">file</span><span class="p">.</span><span class="nx">indexOf</span><span class="p">(</span><span class="nx">source</span><span class="p">)</span> <span class="o">&gt;=</span> <span class="mi">0</span><span class="p">)</span>
201 196
   <span class="nx">removeSource</span> <span class="nx">file</span><span class="p">,</span> <span class="nx">base</span><span class="p">,</span> <span class="kc">yes</span> <span class="k">for</span> <span class="nx">file</span> <span class="k">in</span> <span class="nx">toRemove</span>
202 197
   <span class="k">return</span> <span class="nx">unless</span> <span class="nx">sources</span><span class="p">.</span><span class="nx">some</span> <span class="nf">(s, i) -&gt;</span> <span class="nx">prevSources</span><span class="p">[</span><span class="nx">i</span><span class="p">]</span> <span class="o">isnt</span> <span class="nx">s</span>
@@ -229,8 +224,7 @@
229 224
       <span class="k">else</span> <span class="k">if</span> <span class="nx">opts</span><span class="p">.</span><span class="nx">compile</span> <span class="o">and</span> <span class="nx">opts</span><span class="p">.</span><span class="nx">watch</span>
230 225
         <span class="nx">timeLog</span> <span class="s2">&quot;compiled #{source}&quot;</span>
231 226
   <span class="nx">path</span><span class="p">.</span><span class="nx">exists</span> <span class="nx">jsDir</span><span class="p">,</span> <span class="nf">(exists) -&gt;</span>
232  
-    <span class="k">if</span> <span class="nx">exists</span> <span class="k">then</span> <span class="nx">compile</span><span class="p">()</span> <span class="k">else</span> <span class="nx">exec</span> <span class="s2">&quot;mkdir -p #{jsDir}&quot;</span><span class="p">,</span> <span class="nx">compile</span>
233  
-    </pre></div>             </td>           </tr>                               <tr id="section-18">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-18">&#182;</a>               </div>               <p>Convenience for cleaner setTimeouts.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">wait = </span><span class="nf">(milliseconds, func) -&gt;</span> <span class="nx">setTimeout</span> <span class="nx">func</span><span class="p">,</span> <span class="nx">milliseconds</span></pre></div>             </td>           </tr>                               <tr id="section-19">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-19">&#182;</a>               </div>               <p>When watching scripts, it's useful to log changes with the timestamp.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">timeLog = </span><span class="nf">(message) -&gt;</span>
  227
+    <span class="k">if</span> <span class="nx">exists</span> <span class="k">then</span> <span class="nx">compile</span><span class="p">()</span> <span class="k">else</span> <span class="nx">exec</span> <span class="s2">&quot;mkdir -p #{jsDir}&quot;</span><span class="p">,</span> <span class="nx">compile</span></pre></div>             </td>           </tr>                               <tr id="section-18">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-18">&#182;</a>               </div>               <p>Convenience for cleaner setTimeouts.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">wait = </span><span class="nf">(milliseconds, func) -&gt;</span> <span class="nx">setTimeout</span> <span class="nx">func</span><span class="p">,</span> <span class="nx">milliseconds</span></pre></div>             </td>           </tr>                               <tr id="section-19">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-19">&#182;</a>               </div>               <p>When watching scripts, it's useful to log changes with the timestamp.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">timeLog = </span><span class="nf">(message) -&gt;</span>
234 228
   <span class="nx">console</span><span class="p">.</span><span class="nx">log</span> <span class="s2">&quot;#{(new Date).toLocaleTimeString()} - #{message}&quot;</span></pre></div>             </td>           </tr>                               <tr id="section-20">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-20">&#182;</a>               </div>               <p>Pipe compiled JS through JSLint (requires a working <code>jsl</code> command), printing
235 229
 any errors or warnings that arise.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">lint = </span><span class="nf">(file, js) -&gt;</span>
236 230
   <span class="nv">printIt = </span><span class="nf">(buffer) -&gt;</span> <span class="nx">printLine</span> <span class="nx">file</span> <span class="o">+</span> <span class="s1">&#39;:\t&#39;</span> <span class="o">+</span> <span class="nx">buffer</span><span class="p">.</span><span class="nx">toString</span><span class="p">().</span><span class="nx">trim</span><span class="p">()</span>
@@ -246,13 +240,14 @@
246 240
   <span class="nx">printLine</span> <span class="nx">strings</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="s1">&#39; &#39;</span><span class="p">)</span></pre></div>             </td>           </tr>                               <tr id="section-22">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-22">&#182;</a>               </div>               <p>Use the <a href="optparse.html">OptionParser module</a> to extract all options from
247 241
 <code>process.argv</code> that are specified in <code>SWITCHES</code>.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">parseOptions = </span><span class="o">-&gt;</span>
248 242
   <span class="nv">optionParser  = </span><span class="k">new</span> <span class="nx">optparse</span><span class="p">.</span><span class="nx">OptionParser</span> <span class="nx">SWITCHES</span><span class="p">,</span> <span class="nx">BANNER</span>
249  
-  <span class="nv">o = opts      = </span><span class="nx">optionParser</span><span class="p">.</span><span class="nx">parse</span> <span class="nx">process</span><span class="p">.</span><span class="nx">argv</span><span class="p">.</span><span class="nx">slice</span> <span class="mi">2</span>
  243
+  <span class="nv">o = opts      = </span><span class="nx">optionParser</span><span class="p">.</span><span class="nx">parse</span> <span class="nx">process</span><span class="p">.</span><span class="nx">argv</span><span class="p">[</span><span class="mi">2</span><span class="p">..]</span>
250 244
   <span class="nx">o</span><span class="p">.</span><span class="nx">compile</span>     <span class="o">or=</span>  <span class="o">!!</span><span class="nx">o</span><span class="p">.</span><span class="nx">output</span>
251 245
   <span class="nv">o.run         = </span><span class="o">not</span> <span class="p">(</span><span class="nx">o</span><span class="p">.</span><span class="nx">compile</span> <span class="o">or</span> <span class="nx">o</span><span class="p">.</span><span class="nx">print</span> <span class="o">or</span> <span class="nx">o</span><span class="p">.</span><span class="nx">lint</span><span class="p">)</span>
252 246
   <span class="nv">o.print       = </span><span class="o">!!</span>  <span class="p">(</span><span class="nx">o</span><span class="p">.</span><span class="nx">print</span> <span class="o">or</span> <span class="p">(</span><span class="nx">o</span><span class="p">.</span><span class="nb">eval</span> <span class="o">or</span> <span class="nx">o</span><span class="p">.</span><span class="nx">stdio</span> <span class="o">and</span> <span class="nx">o</span><span class="p">.</span><span class="nx">compile</span><span class="p">))</span>
253 247
   <span class="nv">sources       = </span><span class="nx">o</span><span class="p">.</span><span class="nx">arguments</span>
254 248
   <span class="nx">sourceCode</span><span class="p">[</span><span class="nx">i</span><span class="p">]</span> <span class="o">=</span> <span class="kc">null</span> <span class="k">for</span> <span class="nx">source</span><span class="p">,</span> <span class="nx">i</span> <span class="k">in</span> <span class="nx">sources</span>
255  
-  <span class="k">return</span></pre></div>             </td>           </tr>                               <tr id="section-23">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-23">&#182;</a>               </div>               <p>The compile-time options to pass to the CoffeeScript compiler.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">compileOptions = </span><span class="nf">(filename) -&gt;</span> <span class="p">{</span><span class="nx">filename</span><span class="p">,</span> <span class="nv">bare: </span><span class="nx">opts</span><span class="p">.</span><span class="nx">bare</span><span class="p">}</span></pre></div>             </td>           </tr>                               <tr id="section-24">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-24">&#182;</a>               </div>               <p>Start up a new Node.js instance with the arguments in <code>--nodejs</code> passed to
  249
+  <span class="k">return</span></pre></div>             </td>           </tr>                               <tr id="section-23">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-23">&#182;</a>               </div>               <p>The compile-time options to pass to the CoffeeScript compiler.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">compileOptions = </span><span class="nf">(filename) -&gt;</span>
  250
+  <span class="p">{</span><span class="nx">filename</span><span class="p">,</span> <span class="nv">bare: </span><span class="nx">opts</span><span class="p">.</span><span class="nx">bare</span><span class="p">,</span> <span class="nv">header: </span><span class="nx">opts</span><span class="p">.</span><span class="nx">compile</span><span class="p">}</span></pre></div>             </td>           </tr>                               <tr id="section-24">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-24">&#182;</a>               </div>               <p>Start up a new Node.js instance with the arguments in <code>--nodejs</code> passed to
256 251
 the <code>node</code> binary, preserving the other options.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">forkNode = </span><span class="o">-&gt;</span>
257 252
   <span class="nv">nodeArgs = </span><span class="nx">opts</span><span class="p">.</span><span class="nx">nodejs</span><span class="p">.</span><span class="nx">split</span> <span class="sr">/\s+/</span>
258 253
   <span class="nv">args     = </span><span class="nx">process</span><span class="p">.</span><span class="nx">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">..]</span>
5  documentation/docs/grammar.html
@@ -215,6 +215,7 @@
215 215
     <span class="nx">o</span> <span class="s1">&#39;Expression RangeDots Expression&#39;</span><span class="p">,</span>        <span class="o">-&gt;</span> <span class="k">new</span> <span class="nx">Range</span> <span class="nx">$1</span><span class="p">,</span> <span class="nx">$3</span><span class="p">,</span> <span class="nx">$2</span>
216 216
     <span class="nx">o</span> <span class="s1">&#39;Expression RangeDots&#39;</span><span class="p">,</span>                   <span class="o">-&gt;</span> <span class="k">new</span> <span class="nx">Range</span> <span class="nx">$1</span><span class="p">,</span> <span class="kc">null</span><span class="p">,</span> <span class="nx">$2</span>
217 217
     <span class="nx">o</span> <span class="s1">&#39;RangeDots Expression&#39;</span><span class="p">,</span>                   <span class="o">-&gt;</span> <span class="k">new</span> <span class="nx">Range</span> <span class="kc">null</span><span class="p">,</span> <span class="nx">$2</span><span class="p">,</span> <span class="nx">$1</span>
  218
+    <span class="nx">o</span> <span class="s1">&#39;RangeDots&#39;</span><span class="p">,</span>                              <span class="o">-&gt;</span> <span class="k">new</span> <span class="nx">Range</span> <span class="kc">null</span><span class="p">,</span> <span class="kc">null</span><span class="p">,</span> <span class="nx">$1</span>
218 219
   <span class="p">]</span></pre></div>             </td>           </tr>                               <tr id="section-45">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-45">&#182;</a>               </div>               <p>The <strong>ArgList</strong> is both the list of objects passed into a function call,
219 220
 as well as the contents of an array literal
220 221
 (i.e. comma-separated expressions). Newlines work as well.</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">ArgList: </span><span class="p">[</span>
@@ -348,7 +349,7 @@
348 349
     <span class="nx">o</span> <span class="s1">&#39;Expression LOGIC    Expression&#39;</span><span class="p">,</span>         <span class="o">-&gt;</span> <span class="k">new</span> <span class="nx">Op</span> <span class="nx">$2</span><span class="p">,</span> <span class="nx">$1</span><span class="p">,</span> <span class="nx">$3</span>
349 350
     <span class="nx">o</span> <span class="s1">&#39;Expression RELATION Expression&#39;</span><span class="p">,</span>         <span class="o">-&gt;</span>
350 351
       <span class="k">if</span> <span class="nx">$2</span><span class="p">.</span><span class="nx">charAt</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> <span class="o">is</span> <span class="s1">&#39;!&#39;</span>
351  
-        <span class="k">new</span> <span class="nx">Op</span><span class="p">(</span><span class="nx">$2</span><span class="p">.</span><span class="nx">slice</span><span class="p">(</span><span class="mi">1</span><span class="p">),</span> <span class="nx">$1</span><span class="p">,</span> <span class="nx">$3</span><span class="p">).</span><span class="nx">invert</span><span class="p">()</span>
  352
+        <span class="k">new</span> <span class="nx">Op</span><span class="p">(</span><span class="nx">$2</span><span class="p">[</span><span class="mi">1</span><span class="p">..],</span> <span class="nx">$1</span><span class="p">,</span> <span class="nx">$3</span><span class="p">).</span><span class="nx">invert</span><span class="p">()</span>
352 353
       <span class="k">else</span>
353 354
         <span class="k">new</span> <span class="nx">Op</span> <span class="nx">$2</span><span class="p">,</span> <span class="nx">$1</span><span class="p">,</span> <span class="nx">$3</span>
354 355
 
@@ -381,7 +382,7 @@
381 382
   <span class="p">[</span><span class="s1">&#39;nonassoc&#39;</span><span class="p">,</span>  <span class="s1">&#39;INDENT&#39;</span><span class="p">,</span> <span class="s1">&#39;OUTDENT&#39;</span><span class="p">]</span>
382 383
   <span class="p">[</span><span class="s1">&#39;right&#39;</span><span class="p">,</span>     <span class="s1">&#39;=&#39;</span><span class="p">,</span> <span class="s1">&#39;:&#39;</span><span class="p">,</span> <span class="s1">&#39;COMPOUND_ASSIGN&#39;</span><span class="p">,</span> <span class="s1">&#39;RETURN&#39;</span><span class="p">,</span> <span class="s1">&#39;THROW&#39;</span><span class="p">,</span> <span class="s1">&#39;EXTENDS&#39;</span><span class="p">]</span>
383 384
   <span class="p">[</span><span class="s1">&#39;right&#39;</span><span class="p">,</span>     <span class="s1">&#39;FORIN&#39;</span><span class="p">,</span> <span class="s1">&#39;FOROF&#39;</span><span class="p">,</span> <span class="s1">&#39;BY&#39;</span><span class="p">,</span> <span class="s1">&#39;WHEN&#39;</span><span class="p">]</span>
384  
-  <span class="p">[</span><span class="s1">&#39;right&#39;</span><span class="p">,</span>     <span class="s1">&#39;IF&#39;</span><span class="p">,</span> <span class="s1">&#39;ELSE&#39;</span><span class="p">,</span> <span class="s1">&#39;FOR&#39;</span><span class="p">,</span> <span class="s1">&#39;DO&#39;</span><span class="p">,</span> <span class="s1">&#39;WHILE&#39;</span><span class="p">,</span> <span class="s1">&#39;UNTIL&#39;</span><span class="p">,</span> <span class="s1">&#39;LOOP&#39;</span><span class="p">,</span> <span class="s1">&#39;SUPER&#39;</span><span class="p">,</span> <span class="s1">&#39;CLASS&#39;</span><span class="p">]</span>
  385
+  <span class="p">[</span><span class="s1">&#39;right&#39;</span><span class="p">,</span>     <span class="s1">&#39;IF&#39;</span><span class="p">,</span> <span class="s1">&#39;ELSE&#39;</span><span class="p">,</span> <span class="s1">&#39;FOR&#39;</span><span class="p">,</span> <span class="s1">&#39;WHILE&#39;</span><span class="p">,</span> <span class="s1">&#39;UNTIL&#39;</span><span class="p">,</span> <span class="s1">&#39;LOOP&#39;</span><span class="p">,</span> <span class="s1">&#39;SUPER&#39;</span><span class="p">,</span> <span class="s1">&#39;CLASS&#39;</span><span class="p">]</span>
385 386
   <span class="p">[</span><span class="s1">&#39;right&#39;</span><span class="p">,</span>     <span class="s1">&#39;POST_IF&#39;</span><span class="p">]</span>
386 387
 <span class="p">]</span></pre></div>             </td>           </tr>                               <tr id="section-65">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-65">&#182;</a>               </div>               <h2>Wrapping Up</h2>             </td>             <td class="code">               <div class="highlight"><pre></pre></div>             </td>           </tr>                               <tr id="section-66">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-66">&#182;</a>               </div>               <p>Finally, now that we have our <strong>grammar</strong> and our <strong>operators</strong>, we can create
387 388
 our <strong>Jison.Parser</strong>. We do this by processing all of our rules, recording all
72  documentation/docs/lexer.html
@@ -32,7 +32,7 @@
32 32
     <span class="vi">@tokens  = </span><span class="p">[]</span>             <span class="c1"># Stream of parsed tokens in the form `[&#39;TYPE&#39;, value, line]`.</span></pre></div>             </td>           </tr>                               <tr id="section-6">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-6">&#182;</a>               </div>               <p>At every position, run through this list of attempted matches,
33 33
 short-circuiting if any of them succeed. Their order determines precedence:
34 34
 <code>@literalToken</code> is the fallback catch-all.</p>             </td>             <td class="code">               <div class="highlight"><pre>    <span class="nv">i = </span><span class="mi">0</span>
35  
-    <span class="k">while</span> <span class="vi">@chunk = </span><span class="nx">code</span><span class="p">.</span><span class="nx">slice</span> <span class="nx">i</span>
  35
+    <span class="k">while</span> <span class="vi">@chunk = </span><span class="nx">code</span><span class="p">[</span><span class="nx">i</span><span class="p">..]</span>
36 36
       <span class="nx">i</span> <span class="o">+=</span> <span class="nx">@identifierToken</span><span class="p">()</span> <span class="o">or</span>
37 37
            <span class="nx">@commentToken</span><span class="p">()</span>    <span class="o">or</span>
38 38
            <span class="nx">@whitespaceToken</span><span class="p">()</span> <span class="o">or</span>
@@ -84,7 +84,7 @@
84 84
             <span class="nx">@tokens</span><span class="p">.</span><span class="nx">pop</span><span class="p">()</span>
85 85
             <span class="nv">id = </span><span class="s1">&#39;!&#39;</span> <span class="o">+</span> <span class="nx">id</span>
86 86
 
87  
-    <span class="k">if</span> <span class="nx">id</span> <span class="k">in</span> <span class="p">[</span><span class="s1">&#39;eval&#39;</span><span class="p">,</span> <span class="s1">&#39;arguments&#39;</span><span class="p">].</span><span class="nx">concat</span> <span class="nx">JS_FORBIDDEN</span>
  87
+    <span class="k">if</span> <span class="nx">id</span> <span class="k">in</span> <span class="nx">JS_FORBIDDEN</span>
88 88
       <span class="k">if</span> <span class="nx">forcedIdentifier</span>
89 89
         <span class="nv">tag = </span><span class="s1">&#39;IDENTIFIER&#39;</span>
90 90
         <span class="nv">id  = </span><span class="k">new</span> <span class="nb">String</span> <span class="nx">id</span>
@@ -108,9 +108,19 @@
108 108
 Be careful not to interfere with ranges-in-progress.</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">numberToken: </span><span class="o">-&gt;</span>
109 109
     <span class="k">return</span> <span class="mi">0</span> <span class="nx">unless</span> <span class="nv">match = </span><span class="nx">NUMBER</span><span class="p">.</span><span class="nx">exec</span> <span class="nx">@chunk</span>
110 110
     <span class="nv">number = </span><span class="nx">match</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
  111
+    <span class="k">if</span> <span class="sr">/^0[BOX]/</span><span class="p">.</span><span class="nx">test</span> <span class="nx">number</span>
  112
+      <span class="nx">@error</span> <span class="s2">&quot;radix prefix &#39;#{number}&#39; must be lowercase&quot;</span>
  113
+    <span class="k">else</span> <span class="k">if</span> <span class="sr">/E/</span><span class="p">.</span><span class="nx">test</span><span class="p">(</span><span class="nx">number</span><span class="p">)</span> <span class="o">and</span> <span class="o">not</span> <span class="sr">/^0x/</span><span class="p">.</span><span class="nx">test</span> <span class="nx">number</span>
  114
+      <span class="nx">@error</span> <span class="s2">&quot;exponential notation &#39;#{number}&#39; must be indicated with a lowercase &#39;e&#39;&quot;</span>
  115
+    <span class="k">else</span> <span class="k">if</span> <span class="sr">/^0\d*[89]/</span><span class="p">.</span><span class="nx">test</span> <span class="nx">number</span>
  116
+      <span class="nx">@error</span> <span class="s2">&quot;decimal literal &#39;#{number}&#39; must not be prefixed with &#39;0&#39;&quot;</span>
  117
+    <span class="k">else</span> <span class="k">if</span> <span class="sr">/^0\d+/</span><span class="p">.</span><span class="nx">test</span> <span class="nx">number</span>
  118
+      <span class="nx">@error</span> <span class="s2">&quot;octal literal &#39;#{number}&#39; must be prefixed with &#39;0o&#39;&quot;</span>
111 119
     <span class="nv">lexedLength = </span><span class="nx">number</span><span class="p">.</span><span class="nx">length</span>
112  
-    <span class="k">if</span> <span class="nv">binaryLiteral = </span><span class="sr">/0b([01]+)/</span><span class="p">.</span><span class="nx">exec</span> <span class="nx">number</span>
113  
-      <span class="nv">number = </span><span class="p">(</span><span class="nb">parseInt</span> <span class="nx">binaryLiteral</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="mi">2</span><span class="p">).</span><span class="nx">toString</span><span class="p">()</span>
  120
+    <span class="k">if</span> <span class="nv">octalLiteral = </span><span class="sr">/^0o([0-7]+)/</span><span class="p">.</span><span class="nx">exec</span> <span class="nx">number</span>
  121
+      <span class="nv">number = </span><span class="s1">&#39;0x&#39;</span> <span class="o">+</span> <span class="p">(</span><span class="nb">parseInt</span> <span class="nx">octalLiteral</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="mi">8</span><span class="p">).</span><span class="nx">toString</span> <span class="mi">16</span>
  122
+    <span class="k">if</span> <span class="nv">binaryLiteral = </span><span class="sr">/^0b([01]+)/</span><span class="p">.</span><span class="nx">exec</span> <span class="nx">number</span>
  123
+      <span class="nv">number = </span><span class="s1">&#39;0x&#39;</span> <span class="o">+</span> <span class="p">(</span><span class="nb">parseInt</span> <span class="nx">binaryLiteral</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="mi">2</span><span class="p">).</span><span class="nx">toString</span> <span class="mi">16</span>
114 124
     <span class="nx">@token</span> <span class="s1">&#39;NUMBER&#39;</span><span class="p">,</span> <span class="nx">number</span>
115 125
     <span class="nx">lexedLength</span></pre></div>             </td>           </tr>                               <tr id="section-10">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-10">&#182;</a>               </div>               <p>Matches strings, including multi-line strings. Ensures that quotation marks
116 126
 are balanced within the string's contents, and within nested interpolations.</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">stringToken: </span><span class="o">-&gt;</span>
@@ -121,11 +131,13 @@
121 131
       <span class="k">when</span> <span class="s1">&#39;&quot;&#39;</span>
122 132
         <span class="k">return</span> <span class="mi">0</span> <span class="nx">unless</span> <span class="nv">string = </span><span class="nx">@balancedString</span> <span class="nx">@chunk</span><span class="p">,</span> <span class="s1">&#39;&quot;&#39;</span>
123 133
         <span class="k">if</span> <span class="mi">0</span> <span class="o">&lt;</span> <span class="nx">string</span><span class="p">.</span><span class="nx">indexOf</span> <span class="s1">&#39;#{&#39;</span><span class="p">,</span> <span class="mi">1</span>
124  
-          <span class="nx">@interpolateString</span> <span class="nx">string</span><span class="p">.</span><span class="nx">slice</span> <span class="mi">1</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span>
  134
+          <span class="nx">@interpolateString</span> <span class="nx">string</span><span class="p">[</span><span class="mi">1</span><span class="p">...</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
125 135
         <span class="k">else</span>
126 136
           <span class="nx">@token</span> <span class="s1">&#39;STRING&#39;</span><span class="p">,</span> <span class="nx">@escapeLines</span> <span class="nx">string</span>
127 137
       <span class="k">else</span>
128 138
         <span class="k">return</span> <span class="mi">0</span>
  139
+    <span class="k">if</span> <span class="nv">octalEsc = </span><span class="sr">/^(?:\\.|[^\\])*\\[0-7]/</span><span class="p">.</span><span class="nx">test</span> <span class="nx">string</span>
  140
+      <span class="nx">@error</span> <span class="s2">&quot;octal escape sequences #{string} are not allowed&quot;</span>
129 141
     <span class="nx">@line</span> <span class="o">+=</span> <span class="nx">count</span> <span class="nx">string</span><span class="p">,</span> <span class="s1">&#39;\n&#39;</span>
130 142
     <span class="nx">string</span><span class="p">.</span><span class="nx">length</span></pre></div>             </td>           </tr>                               <tr id="section-11">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-11">&#182;</a>               </div>               <p>Matches heredocs, adjusting indentation to the correct level, as heredocs
131 143
 preserve whitespace, but ignore indentation to the left.</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">heredocToken: </span><span class="o">-&gt;</span>
@@ -144,11 +156,10 @@
144 156
     <span class="k">if</span> <span class="nx">here</span>
145 157
       <span class="nx">@token</span> <span class="s1">&#39;HERECOMMENT&#39;</span><span class="p">,</span> <span class="nx">@sanitizeHeredoc</span> <span class="nx">here</span><span class="p">,</span>
146 158
         <span class="nv">herecomment: </span><span class="kc">true</span><span class="p">,</span> <span class="nv">indent: </span><span class="nb">Array</span><span class="p">(</span><span class="nx">@indent</span> <span class="o">+</span> <span class="mi">1</span><span class="p">).</span><span class="nx">join</span><span class="p">(</span><span class="s1">&#39; &#39;</span><span class="p">)</span>
147  
-      <span class="nx">@token</span> <span class="s1">&#39;TERMINATOR&#39;</span><span class="p">,</span> <span class="s1">&#39;\n&#39;</span>
148 159
     <span class="nx">@line</span> <span class="o">+=</span> <span class="nx">count</span> <span class="nx">comment</span><span class="p">,</span> <span class="s1">&#39;\n&#39;</span>
149 160
     <span class="nx">comment</span><span class="p">.</span><span class="nx">length</span></pre></div>             </td>           </tr>                               <tr id="section-13">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-13">&#182;</a>               </div>               <p>Matches JavaScript interpolated directly into the source via backticks.</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">jsToken: </span><span class="o">-&gt;</span>
150 161
     <span class="k">return</span> <span class="mi">0</span> <span class="nx">unless</span> <span class="nx">@chunk</span><span class="p">.</span><span class="nx">charAt</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> <span class="o">is</span> <span class="s1">&#39;`&#39;</span> <span class="o">and</span> <span class="nv">match = </span><span class="nx">JSTOKEN</span><span class="p">.</span><span class="nx">exec</span> <span class="nx">@chunk</span>
151  
-    <span class="nx">@token</span> <span class="s1">&#39;JS&#39;</span><span class="p">,</span> <span class="p">(</span><span class="nv">script = </span><span class="nx">match</span><span class="p">[</span><span class="mi">0</span><span class="p">]).</span><span class="nx">slice</span> <span class="mi">1</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span>
  162
+    <span class="nx">@token</span> <span class="s1">&#39;JS&#39;</span><span class="p">,</span> <span class="p">(</span><span class="nv">script = </span><span class="nx">match</span><span class="p">[</span><span class="mi">0</span><span class="p">])[</span><span class="mi">1</span><span class="p">...</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
152 163
     <span class="nx">script</span><span class="p">.</span><span class="nx">length</span></pre></div>             </td>           </tr>                               <tr id="section-14">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-14">&#182;</a>               </div>               <p>Matches regular expression literals. Lexing regular expressions is difficult
153 164
 to distinguish from division, so we borrow some basic heuristics from
154 165
 JavaScript and Ruby.</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">regexToken: </span><span class="o">-&gt;</span>
@@ -275,9 +286,9 @@
275 286
         <span class="nx">prev</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;COMPOUND_ASSIGN&#39;</span>
276 287
         <span class="nx">prev</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">+=</span> <span class="s1">&#39;=&#39;</span>
277 288
         <span class="k">return</span> <span class="nx">value</span><span class="p">.</span><span class="nx">length</span>
278  
-    <span class="k">if</span> <span class="nx">value</span> <span class="o">is</span> <span class="s1">&#39;;&#39;</span>             
279  
-     <span class="vi">@seenFor = </span><span class="kc">no</span>
280  
-     <span class="nv">tag = </span><span class="s1">&#39;TERMINATOR&#39;</span>
  289
+    <span class="k">if</span> <span class="nx">value</span> <span class="o">is</span> <span class="s1">&#39;;&#39;</span>
  290
+      <span class="vi">@seenFor = </span><span class="kc">no</span>
  291
+      <span class="nv">tag = </span><span class="s1">&#39;TERMINATOR&#39;</span>
281 292
     <span class="k">else</span> <span class="k">if</span> <span class="nx">value</span> <span class="k">in</span> <span class="nx">MATH</span>            <span class="k">then</span> <span class="nv">tag = </span><span class="s1">&#39;MATH&#39;</span>
282 293
     <span class="k">else</span> <span class="k">if</span> <span class="nx">value</span> <span class="k">in</span> <span class="nx">COMPARE</span>         <span class="k">then</span> <span class="nv">tag = </span><span class="s1">&#39;COMPARE&#39;</span>
283 294
     <span class="k">else</span> <span class="k">if</span> <span class="nx">value</span> <span class="k">in</span> <span class="nx">COMPOUND_ASSIGN</span> <span class="k">then</span> <span class="nv">tag = </span><span class="s1">&#39;COMPOUND_ASSIGN&#39;</span>
@@ -332,22 +343,26 @@
332 343
 a series of delimiters, all of which must be nested correctly within the
333 344
 contents of the string. This method allows us to have strings within
334 345
 interpolations within strings, ad infinitum.</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">balancedString: </span><span class="nf">(str, end) -&gt;</span>
  346
+    <span class="nv">continueCount = </span><span class="mi">0</span>
335 347
     <span class="nv">stack = </span><span class="p">[</span><span class="nx">end</span><span class="p">]</span>
336 348
     <span class="k">for</span> <span class="nx">i</span> <span class="k">in</span> <span class="p">[</span><span class="mi">1</span><span class="p">...</span><span class="nx">str</span><span class="p">.</span><span class="nx">length</span><span class="p">]</span>
  349
+      <span class="k">if</span> <span class="nx">continueCount</span>
  350
+        <span class="o">--</span><span class="nx">continueCount</span>
  351
+        <span class="k">continue</span>
337 352
       <span class="k">switch</span> <span class="nv">letter = </span><span class="nx">str</span><span class="p">.</span><span class="nx">charAt</span> <span class="nx">i</span>
338 353
         <span class="k">when</span> <span class="s1">&#39;\\&#39;</span>
339  
-          <span class="nx">i</span><span class="o">++</span>
  354
+          <span class="o">++</span><span class="nx">continueCount</span>
340 355
           <span class="k">continue</span>
341 356
         <span class="k">when</span> <span class="nx">end</span>
342 357
           <span class="nx">stack</span><span class="p">.</span><span class="nx">pop</span><span class="p">()</span>
343 358
           <span class="nx">unless</span> <span class="nx">stack</span><span class="p">.</span><span class="nx">length</span>
344  
-            <span class="k">return</span> <span class="nx">str</span><span class="p">.</span><span class="nx">slice</span> <span class="mi">0</span><span class="p">,</span> <span class="nx">i</span> <span class="o">+</span> <span class="mi">1</span>
  359
+            <span class="k">return</span> <span class="nx">str</span><span class="p">[</span><span class="mi">0</span><span class="p">..</span><span class="nx">i</span><span class="p">]</span>
345 360
           <span class="nv">end = </span><span class="nx">stack</span><span class="p">[</span><span class="nx">stack</span><span class="p">.</span><span class="nx">length</span> <span class="o">-</span> <span class="mi">1</span><span class="p">]</span>
346 361
           <span class="k">continue</span>
347 362
       <span class="k">if</span> <span class="nx">end</span> <span class="o">is</span> <span class="s1">&#39;}&#39;</span> <span class="o">and</span> <span class="nx">letter</span> <span class="k">in</span> <span class="p">[</span><span class="s1">&#39;&quot;&#39;</span><span class="p">,</span> <span class="s2">&quot;&#39;&quot;</span><span class="p">]</span>
348 363
         <span class="nx">stack</span><span class="p">.</span><span class="nx">push</span> <span class="nv">end = </span><span class="nx">letter</span>
349  
-      <span class="k">else</span> <span class="k">if</span> <span class="nx">end</span> <span class="o">is</span> <span class="s1">&#39;}&#39;</span> <span class="o">and</span> <span class="nx">letter</span> <span class="o">is</span> <span class="s1">&#39;/&#39;</span> <span class="o">and</span> <span class="nv">match = </span><span class="p">(</span><span class="nx">HEREGEX</span><span class="p">.</span><span class="nx">exec</span><span class="p">(</span><span class="nx">str</span><span class="p">.</span><span class="nx">slice</span> <span class="nx">i</span><span class="p">)</span> <span class="o">or</span> <span class="nx">REGEX</span><span class="p">.</span><span class="nx">exec</span><span class="p">(</span><span class="nx">str</span><span class="p">.</span><span class="nx">slice</span> <span class="nx">i</span><span class="p">))</span>
350  
-        <span class="nx">i</span> <span class="o">+=</span> <span class="nx">match</span><span class="p">[</span><span class="mi">0</span><span class="p">].</span><span class="nx">length</span> <span class="o">-</span> <span class="mi">1</span>
  364
+      <span class="k">else</span> <span class="k">if</span> <span class="nx">end</span> <span class="o">is</span> <span class="s1">&#39;}&#39;</span> <span class="o">and</span> <span class="nx">letter</span> <span class="o">is</span> <span class="s1">&#39;/&#39;</span> <span class="o">and</span> <span class="nv">match = </span><span class="p">(</span><span class="nx">HEREGEX</span><span class="p">.</span><span class="nx">exec</span><span class="p">(</span><span class="nx">str</span><span class="p">[</span><span class="nx">i</span><span class="p">..])</span> <span class="o">or</span> <span class="nx">REGEX</span><span class="p">.</span><span class="nx">exec</span><span class="p">(</span><span class="nx">str</span><span class="p">[</span><span class="nx">i</span><span class="p">..]))</span>
  365
+        <span class="nx">continueCount</span> <span class="o">+=</span> <span class="nx">match</span><span class="p">[</span><span class="mi">0</span><span class="p">].</span><span class="nx">length</span> <span class="o">-</span> <span class="mi">1</span>
351 366
       <span class="k">else</span> <span class="k">if</span> <span class="nx">end</span> <span class="o">is</span> <span class="s1">&#39;}&#39;</span> <span class="o">and</span> <span class="nx">letter</span> <span class="o">is</span> <span class="s1">&#39;{&#39;</span>
352 367
         <span class="nx">stack</span><span class="p">.</span><span class="nx">push</span> <span class="nv">end = </span><span class="s1">&#39;}&#39;</span>
353 368
       <span class="k">else</span> <span class="k">if</span> <span class="nx">end</span> <span class="o">is</span> <span class="s1">&#39;&quot;&#39;</span> <span class="o">and</span> <span class="nx">prev</span> <span class="o">is</span> <span class="s1">&#39;#&#39;</span> <span class="o">and</span> <span class="nx">letter</span> <span class="o">is</span> <span class="s1">&#39;{&#39;</span>
@@ -371,10 +386,10 @@
371 386
         <span class="nx">i</span> <span class="o">+=</span> <span class="mi">1</span>
372 387
         <span class="k">continue</span>
373 388
       <span class="nx">unless</span> <span class="nx">letter</span> <span class="o">is</span> <span class="s1">&#39;#&#39;</span> <span class="o">and</span> <span class="nx">str</span><span class="p">.</span><span class="nx">charAt</span><span class="p">(</span><span class="nx">i</span><span class="o">+</span><span class="mi">1</span><span class="p">)</span> <span class="o">is</span> <span class="s1">&#39;{&#39;</span> <span class="o">and</span>
374  
-             <span class="p">(</span><span class="nv">expr = </span><span class="nx">@balancedString</span> <span class="nx">str</span><span class="p">.</span><span class="nx">slice</span><span class="p">(</span><span class="nx">i</span> <span class="o">+</span> <span class="mi">1</span><span class="p">),</span> <span class="s1">&#39;}&#39;</span><span class="p">)</span>
  389
+             <span class="p">(</span><span class="nv">expr = </span><span class="nx">@balancedString</span> <span class="nx">str</span><span class="p">[</span><span class="nx">i</span> <span class="o">+</span> <span class="mi">1</span><span class="p">..],</span> <span class="s1">&#39;}&#39;</span><span class="p">)</span>
375 390
         <span class="k">continue</span>
376  
-      <span class="nx">tokens</span><span class="p">.</span><span class="nx">push</span> <span class="p">[</span><span class="s1">&#39;NEOSTRING&#39;</span><span class="p">,</span> <span class="nx">str</span><span class="p">.</span><span class="nx">slice</span><span class="p">(</span><span class="nx">pi</span><span class="p">,</span> <span class="nx">i</span><span class="p">)]</span> <span class="k">if</span> <span class="nx">pi</span> <span class="o">&lt;</span> <span class="nx">i</span>
377  
-      <span class="nv">inner = </span><span class="nx">expr</span><span class="p">.</span><span class="nx">slice</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">)</span>
  391
+      <span class="nx">tokens</span><span class="p">.</span><span class="nx">push</span> <span class="p">[</span><span class="s1">&#39;NEOSTRING&#39;</span><span class="p">,</span> <span class="nx">str</span><span class="p">[</span><span class="nx">pi</span><span class="p">...</span><span class="nx">i</span><span class="p">]]</span> <span class="k">if</span> <span class="nx">pi</span> <span class="o">&lt;</span> <span class="nx">i</span>
  392
+      <span class="nv">inner = </span><span class="nx">expr</span><span class="p">[</span><span class="mi">1</span><span class="p">...</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
378 393
       <span class="k">if</span> <span class="nx">inner</span><span class="p">.</span><span class="nx">length</span>
379 394
         <span class="nv">nested = </span><span class="k">new</span> <span class="nx">Lexer</span><span class="p">().</span><span class="nx">tokenize</span> <span class="nx">inner</span><span class="p">,</span> <span class="nv">line: </span><span class="nx">@line</span><span class="p">,</span> <span class="nv">rewrite: </span><span class="kc">off</span>
380 395
         <span class="nx">nested</span><span class="p">.</span><span class="nx">pop</span><span class="p">()</span>
@@ -386,7 +401,7 @@
386 401
           <span class="nx">tokens</span><span class="p">.</span><span class="nx">push</span> <span class="p">[</span><span class="s1">&#39;TOKENS&#39;</span><span class="p">,</span> <span class="nx">nested</span><span class="p">]</span>
387 402
       <span class="nx">i</span> <span class="o">+=</span> <span class="nx">expr</span><span class="p">.</span><span class="nx">length</span>
388 403
       <span class="nv">pi = </span><span class="nx">i</span> <span class="o">+</span> <span class="mi">1</span>
389  
-    <span class="nx">tokens</span><span class="p">.</span><span class="nx">push</span> <span class="p">[</span><span class="s1">&#39;NEOSTRING&#39;</span><span class="p">,</span> <span class="nx">str</span><span class="p">.</span><span class="nx">slice</span> <span class="nx">pi</span><span class="p">]</span> <span class="k">if</span> <span class="nx">i</span> <span class="o">&gt;</span> <span class="nx">pi</span> <span class="o">&lt;</span> <span class="nx">str</span><span class="p">.</span><span class="nx">length</span>
  404
+    <span class="nx">tokens</span><span class="p">.</span><span class="nx">push</span> <span class="p">[</span><span class="s1">&#39;NEOSTRING&#39;</span><span class="p">,</span> <span class="nx">str</span><span class="p">[</span><span class="nx">pi</span><span class="p">..]]</span> <span class="k">if</span> <span class="nx">i</span> <span class="o">&gt;</span> <span class="nx">pi</span> <span class="o">&lt;</span> <span class="nx">str</span><span class="p">.</span><span class="nx">length</span>
390 405
     <span class="k">return</span> <span class="nx">tokens</span> <span class="k">if</span> <span class="nx">regex</span>
391 406
     <span class="k">return</span> <span class="nx">@token</span> <span class="s1">&#39;STRING&#39;</span><span class="p">,</span> <span class="s1">&#39;&quot;&quot;&#39;</span> <span class="nx">unless</span> <span class="nx">tokens</span><span class="p">.</span><span class="nx">length</span>
392 407
     <span class="nx">tokens</span><span class="p">.</span><span class="nx">unshift</span> <span class="p">[</span><span class="s1">&#39;&#39;</span><span class="p">,</span> <span class="s1">&#39;&#39;</span><span class="p">]</span> <span class="nx">unless</span> <span class="nx">tokens</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span> <span class="o">is</span> <span class="s1">&#39;NEOSTRING&#39;</span>
@@ -414,14 +429,13 @@
414 429
     <span class="p">(</span><span class="nv">tok = </span><span class="nx">last</span> <span class="nx">@tokens</span><span class="p">,</span> <span class="nx">index</span><span class="p">)</span> <span class="o">and</span> <span class="k">if</span> <span class="nx">val</span> <span class="k">then</span> <span class="nx">tok</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">=</span> <span class="nx">val</span> <span class="k">else</span> <span class="nx">tok</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span></pre></div>             </td>           </tr>                               <tr id="section-34">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-34">&#182;</a>               </div>               <p>Are we in the midst of an unfinished expression?</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">unfinished: </span><span class="o">-&gt;</span>
415 430
     <span class="nx">LINE_CONTINUER</span><span class="p">.</span><span class="nx">test</span><span class="p">(</span><span class="nx">@chunk</span><span class="p">)</span> <span class="o">or</span>
416 431
     <span class="nx">@tag</span><span class="p">()</span> <span class="k">in</span> <span class="p">[</span><span class="s1">&#39;\\&#39;</span><span class="p">,</span> <span class="s1">&#39;.&#39;</span><span class="p">,</span> <span class="s1">&#39;?.&#39;</span><span class="p">,</span> <span class="s1">&#39;UNARY&#39;</span><span class="p">,</span> <span class="s1">&#39;MATH&#39;</span><span class="p">,</span> <span class="s1">&#39;+&#39;</span><span class="p">,</span> <span class="s1">&#39;-&#39;</span><span class="p">,</span> <span class="s1">&#39;SHIFT&#39;</span><span class="p">,</span> <span class="s1">&#39;RELATION&#39;</span>
417  
-               <span class="s1">&#39;COMPARE&#39;</span><span class="p">,</span> <span class="s1">&#39;LOGIC&#39;</span><span class="p">,</span> <span class="s1">&#39;COMPOUND_ASSIGN&#39;</span><span class="p">,</span> <span class="s1">&#39;THROW&#39;</span><span class="p">,</span> <span class="s1">&#39;EXTENDS&#39;</span><span class="p">]</span></pre></div>             </td>           </tr>                               <tr id="section-35">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-35">&#182;</a>               </div>               <p>Converts newlines for string literals.</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">escapeLines: </span><span class="nf">(str, heredoc) -&gt;</span>
  432
+               <span class="s1">&#39;COMPARE&#39;</span><span class="p">,</span> <span class="s1">&#39;LOGIC&#39;</span><span class="p">,</span> <span class="s1">&#39;THROW&#39;</span><span class="p">,</span> <span class="s1">&#39;EXTENDS&#39;</span><span class="p">]</span></pre></div>             </td>           </tr>                               <tr id="section-35">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-35">&#182;</a>               </div>               <p>Converts newlines for string literals.</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">escapeLines: </span><span class="nf">(str, heredoc) -&gt;</span>
418 433
     <span class="nx">str</span><span class="p">.</span><span class="nx">replace</span> <span class="nx">MULTILINER</span><span class="p">,</span> <span class="k">if</span> <span class="nx">heredoc</span> <span class="k">then</span> <span class="s1">&#39;\\n&#39;</span> <span class="k">else</span> <span class="s1">&#39;&#39;</span></pre></div>             </td>           </tr>                               <tr id="section-36">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-36">&#182;</a>               </div>               <p>Constructs a string token by escaping quotes and newlines.</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">makeString: </span><span class="nf">(body, quote, heredoc) -&gt;</span>
419 434
     <span class="k">return</span> <span class="nx">quote</span> <span class="o">+</span> <span class="nx">quote</span> <span class="nx">unless</span> <span class="nx">body</span>
420 435
     <span class="nv">body = </span><span class="nx">body</span><span class="p">.</span><span class="nx">replace</span> <span class="sr">/\\([\s\S])/g</span><span class="p">,</span> <span class="nf">(match, contents) -&gt;</span>
421 436
       <span class="k">if</span> <span class="nx">contents</span> <span class="k">in</span> <span class="p">[</span><span class="s1">&#39;\n&#39;</span><span class="p">,</span> <span class="nx">quote</span><span class="p">]</span> <span class="k">then</span> <span class="nx">contents</span> <span class="k">else</span> <span class="nx">match</span>
422 437
     <span class="nv">body = </span><span class="nx">body</span><span class="p">.</span><span class="nx">replace</span> <span class="err">/// #{quote} ///g, &#39;\\$&amp;&#39;</span>
423  
-    <span class="nx">quote</span> <span class="o">+</span> <span class="nx">@escapeLines</span><span class="p">(</span><span class="nx">body</span><span class="p">,</span> <span class="nx">heredoc</span><span class="p">)</span> <span class="o">+</span> <span class="nx">quote</span>
424  
-    </pre></div>             </td>           </tr>                               <tr id="section-37">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-37">&#182;</a>               </div>               <p>Throws a syntax error on the current <code>@line</code>.</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">error: </span><span class="nf">(message) -&gt;</span> 
  438
+    <span class="nx">quote</span> <span class="o">+</span> <span class="nx">@escapeLines</span><span class="p">(</span><span class="nx">body</span><span class="p">,</span> <span class="nx">heredoc</span><span class="p">)</span> <span class="o">+</span> <span class="nx">quote</span></pre></div>             </td>           </tr>                               <tr id="section-37">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-37">&#182;</a>               </div>               <p>Throws a syntax error on the current <code>@line</code>.</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">error: </span><span class="nf">(message) -&gt;</span>
425 439
     <span class="k">throw</span> <span class="nx">SyntaxError</span> <span class="s2">&quot;#{message} on line #{ @line + 1}&quot;</span></pre></div>             </td>           </tr>                               <tr id="section-38">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-38">&#182;</a>               </div>               <h2>Constants</h2>             </td>             <td class="code">               <div class="highlight"><pre></pre></div>             </td>           </tr>                               <tr id="section-39">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-39">&#182;</a>               </div>               <p>Keywords that CoffeeScript shares in common with JavaScript.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">JS_KEYWORDS = </span><span class="p">[</span>
426 440
   <span class="s1">&#39;true&#39;</span><span class="p">,</span> <span class="s1">&#39;false&#39;</span><span class="p">,</span> <span class="s1">&#39;null&#39;</span><span class="p">,</span> <span class="s1">&#39;this&#39;</span>
427 441
   <span class="s1">&#39;new&#39;</span><span class="p">,</span> <span class="s1">&#39;delete&#39;</span><span class="p">,</span> <span class="s1">&#39;typeof&#39;</span><span class="p">,</span> <span class="s1">&#39;in&#39;</span><span class="p">,</span> <span class="s1">&#39;instanceof&#39;</span>
@@ -448,17 +462,23 @@
448 462
   <span class="s1">&#39;case&#39;</span><span class="p">,</span> <span class="s1">&#39;default&#39;</span><span class="p">,</span> <span class="s1">&#39;function&#39;</span><span class="p">,</span> <span class="s1">&#39;var&#39;</span><span class="p">,</span> <span class="s1">&#39;void&#39;</span><span class="p">,</span> <span class="s1">&#39;with&#39;</span>
449 463
   <span class="s1">&#39;const&#39;</span><span class="p">,</span> <span class="s1">&#39;let&#39;</span><span class="p">,</span> <span class="s1">&#39;enum&#39;</span><span class="p">,</span> <span class="s1">&#39;export&#39;</span><span class="p">,</span> <span class="s1">&#39;import&#39;</span><span class="p">,</span> <span class="s1">&#39;native&#39;</span>
450 464
   <span class="s1">&#39;__hasProp&#39;</span><span class="p">,</span> <span class="s1">&#39;__extends&#39;</span><span class="p">,</span> <span class="s1">&#39;__slice&#39;</span><span class="p">,</span> <span class="s1">&#39;__bind&#39;</span><span class="p">,</span> <span class="s1">&#39;__indexOf&#39;</span>
451  
-<span class="p">]</span></pre></div>             </td>           </tr>                               <tr id="section-42">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-42">&#182;</a>               </div>               <p>The superset of both JavaScript keywords and reserved words, none of which may
452  
-be used as identifiers or properties.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">JS_FORBIDDEN = </span><span class="nx">JS_KEYWORDS</span><span class="p">.</span><span class="nx">concat</span> <span class="nx">RESERVED</span>
  465
+  <span class="s1">&#39;implements&#39;</span><span class="p">,</span> <span class="s1">&#39;interface&#39;</span><span class="p">,</span> <span class="s1">&#39;let&#39;</span><span class="p">,</span> <span class="s1">&#39;package&#39;</span><span class="p">,</span>
  466
+  <span class="s1">&#39;private&#39;</span><span class="p">,</span> <span class="s1">&#39;protected&#39;</span><span class="p">,</span> <span class="s1">&#39;public&#39;</span><span class="p">,</span> <span class="s1">&#39;static&#39;</span><span class="p">,</span> <span class="s1">&#39;yield&#39;</span>
  467
+<span class="p">]</span>
  468
+
  469
+<span class="nv">STRICT_PROSCRIBED = </span><span class="p">[</span><span class="s1">&#39;arguments&#39;</span><span class="p">,</span> <span class="s1">&#39;eval&#39;</span><span class="p">]</span></pre></div>             </td>           </tr>                               <tr id="section-42">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-42">&#182;</a>               </div>               <p>The superset of both JavaScript keywords and reserved words, none of which may
  470
+be used as identifiers or properties.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">JS_FORBIDDEN = </span><span class="nx">JS_KEYWORDS</span><span class="p">.</span><span class="nx">concat</span><span class="p">(</span><span class="nx">RESERVED</span><span class="p">).</span><span class="nx">concat</span><span class="p">(</span><span class="nx">STRICT_PROSCRIBED</span><span class="p">)</span>
453 471
 
454  
-<span class="nv">exports.RESERVED = </span><span class="nx">RESERVED</span><span class="p">.</span><span class="nx">concat</span><span class="p">(</span><span class="nx">JS_KEYWORDS</span><span class="p">).</span><span class="nx">concat</span><span class="p">(</span><span class="nx">COFFEE_KEYWORDS</span><span class="p">)</span></pre></div>             </td>           </tr>                               <tr id="section-43">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-43">&#182;</a>               </div>               <p>Token matching regexes.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">IDENTIFIER = </span><span class="err">/// ^</span>
  472
+<span class="nv">exports.RESERVED = </span><span class="nx">RESERVED</span><span class="p">.</span><span class="nx">concat</span><span class="p">(</span><span class="nx">JS_KEYWORDS</span><span class="p">).</span><span class="nx">concat</span><span class="p">(</span><span class="nx">COFFEE_KEYWORDS</span><span class="p">).</span><span class="nx">concat</span><span class="p">(</span><span class="nx">STRICT_PROSCRIBED</span><span class="p">)</span>
  473
+<span class="nv">exports.STRICT_PROSCRIBED = </span><span class="nx">STRICT_PROSCRIBED</span></pre></div>             </td>           </tr>                               <tr id="section-43">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-43">&#182;</a>               </div>               <p>Token matching regexes.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">IDENTIFIER = </span><span class="err">/// ^</span>
455 474
   <span class="p">(</span> <span class="p">[</span><span class="nx">$A</span><span class="o">-</span><span class="nx">Za</span><span class="o">-</span><span class="nx">z_</span><span class="err">\</span><span class="nx">x7f</span><span class="o">-</span><span class="err">\</span><span class="nx">uffff</span><span class="p">][</span><span class="nx">$</span><span class="err">\</span><span class="nx">w</span><span class="err">\</span><span class="nx">x7f</span><span class="o">-</span><span class="err">\</span><span class="nx">uffff</span><span class="p">]</span><span class="o">*</span> <span class="p">)</span>
456 475
   <span class="p">(</span> <span class="p">[</span><span class="o">^</span><span class="err">\</span><span class="nx">n</span><span class="err">\</span><span class="nx">S</span><span class="p">]</span><span class="o">*</span> <span class="o">:</span> <span class="p">(</span><span class="o">?!:</span><span class="p">)</span> <span class="p">)</span><span class="o">?</span>  <span class="c1"># Is this a property name?</span>
457 476
 <span class="err">///</span>
458 477
 
459 478
 <span class="nv">NUMBER     = </span><span class="err">///</span>
460  
-  <span class="o">^</span> <span class="mi">0</span><span class="nx">x</span><span class="p">[</span><span class="err">\</span><span class="nx">da</span><span class="o">-</span><span class="nx">f</span><span class="p">]</span><span class="o">+</span> <span class="o">|</span>                              <span class="c1"># hex</span>
461  
-  <span class="o">^</span> <span class="mi">0</span><span class="nx">b</span><span class="p">[</span><span class="mi">01</span><span class="p">]</span><span class="o">+</span> <span class="o">|</span>                              <span class="c1"># binary</span>
  479
+  <span class="o">^</span> <span class="mi">0</span><span class="nx">b</span><span class="p">[</span><span class="mi">01</span><span class="p">]</span><span class="o">+</span>    <span class="o">|</span>              <span class="c1"># binary</span>
  480
+  <span class="o">^</span> <span class="mi">0</span><span class="nx">o</span><span class="p">[</span><span class="mi">0</span><span class="o">-</span><span class="mi">7</span><span class="p">]</span><span class="o">+</span>   <span class="o">|</span>              <span class="c1"># octal</span>
  481
+  <span class="o">^</span> <span class="mi">0</span><span class="nx">x</span><span class="p">[</span><span class="err">\</span><span class="nx">da</span><span class="o">-</span><span class="nx">f</span><span class="p">]</span><span class="o">+</span> <span class="o">|</span>              <span class="c1"># hex</span>
462 482
   <span class="o">^</span> <span class="err">\</span><span class="nx">d</span><span class="o">*</span><span class="err">\</span><span class="p">.</span><span class="o">?</span><span class="err">\</span><span class="nx">d</span><span class="o">+</span> <span class="p">(</span><span class="o">?:</span><span class="nx">e</span><span class="p">[</span><span class="o">+-</span><span class="p">]</span><span class="o">?</span><span class="err">\</span><span class="nx">d</span><span class="o">+</span><span class="p">)</span><span class="o">?</span>  <span class="c1"># decimal</span>
463 483
 <span class="err">///i</span>
464 484
 
316  documentation/docs/nodes.html
207 additions, 109 deletions not shown
62  documentation/docs/optparse.html
@@ -13,34 +13,40 @@
13 13
 
14 14
 <p>Along with an an optional banner for the usage help.</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">constructor: </span><span class="nf">(rules, @banner) -&gt;</span>
15 15
     <span class="vi">@rules = </span><span class="nx">buildRules</span> <span class="nx">rules</span></pre></div>             </td>           </tr>                               <tr id="section-3">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-3">&#182;</a>               </div>               <p>Parse the list of arguments, populating an <code>options</code> object with all of the
16  
-specified options, and return it. <code>options.arguments</code> will be an array
17  
-containing the remaining non-option arguments. <code>options.literals</code> will be
18  
-an array of options that are meant to be passed through directly to the
19  
-executing script. This is a simpler API than many option parsers that allow
20  
-you to attach callback actions for every flag. Instead, you're responsible
21  
-for interpreting the options object.</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">parse: </span><span class="nf">(args) -&gt;</span>
22  
-    <span class="nv">options = arguments: </span><span class="p">[],</span> <span class="nv">literals: </span><span class="p">[]</span>
  16
+specified options, and return it. Options after the first non-option
  17
+argument are treated as arguments. <code>options.arguments</code> will be an array
  18
+containing the remaining arguments. This is a simpler API than many option
  19
+parsers that allow you to attach callback actions for every flag. Instead,
  20
+you're responsible for interpreting the options object.</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">parse: </span><span class="nf">(args) -&gt;</span>
  21
+    <span class="nv">options = arguments: </span><span class="p">[]</span>
  22
+    <span class="nv">skippingArgument = </span><span class="kc">no</span>
23 23
     <span class="nv">originalArgs = </span><span class="nx">args</span>
24 24
     <span class="nv">args = </span><span class="nx">normalizeArguments</span> <span class="nx">args</span>
25 25
     <span class="k">for</span> <span class="nx">arg</span><span class="p">,</span> <span class="nx">i</span> <span class="k">in</span> <span class="nx">args</span>
  26
+      <span class="k">if</span> <span class="nx">skippingArgument</span>
  27
+        <span class="nv">skippingArgument = </span><span class="kc">no</span>
  28
+        <span class="k">continue</span>
26 29
       <span class="k">if</span> <span class="nx">arg</span> <span class="o">is</span> <span class="s1">&#39;--&#39;</span>
27 30
         <span class="nv">pos = </span><span class="nx">originalArgs</span><span class="p">.</span><span class="nx">indexOf</span> <span class="s1">&#39;--&#39;</span>
28  
-        <span class="nv">options.arguments = </span><span class="p">[</span><span class="nx">originalArgs</span><span class="p">[</span><span class="mi">1</span> <span class="o">+</span> <span class="nx">pos</span><span class="p">]]</span>
29  
-        <span class="nv">options.literals = </span><span class="nx">originalArgs</span><span class="p">[(</span><span class="mi">2</span> <span class="o">+</span> <span class="nx">pos</span><span class="p">)..]</span>
  31
+        <span class="nv">options.arguments = </span><span class="nx">options</span><span class="p">.</span><span class="nx">arguments</span><span class="p">.</span><span class="nx">concat</span> <span class="nx">originalArgs</span><span class="p">[(</span><span class="nx">pos</span> <span class="o">+</span> <span class="mi">1</span><span class="p">)..]</span>
30 32
         <span class="k">break</span>
31  
-      <span class="nv">isOption = </span><span class="o">!!</span><span class="p">(</span><span class="nx">arg</span><span class="p">.</span><span class="nx">match</span><span class="p">(</span><span class="nx">LONG_FLAG</span><span class="p">)</span> <span class="o">or</span> <span class="nx">arg</span><span class="p">.</span><span class="nx">match</span><span class="p">(</span><span class="nx">SHORT_FLAG</span><span class="p">))</span>
32  
-      <span class="nv">matchedRule = </span><span class="kc">no</span>
33  
-      <span class="k">for</span> <span class="nx">rule</span> <span class="k">in</span> <span class="nx">@rules</span>
34  
-        <span class="k">if</span> <span class="nx">rule</span><span class="p">.</span><span class="nx">shortFlag</span> <span class="o">is</span> <span class="nx">arg</span> <span class="o">or</span> <span class="nx">rule</span><span class="p">.</span><span class="nx">longFlag</span> <span class="o">is</span> <span class="nx">arg</span>
35  
-          <span class="nv">value = </span><span class="k">if</span> <span class="nx">rule</span><span class="p">.</span><span class="nx">hasArgument</span> <span class="k">then</span> <span class="nx">args</span><span class="p">[</span><span class="nx">i</span> <span class="o">+=</span> <span class="mi">1</span><span class="p">]</span> <span class="k">else</span> <span class="kc">true</span>
36  
-          <span class="nx">options</span><span class="p">[</span><span class="nx">rule</span><span class="p">.</span><span class="nx">name</span><span class="p">]</span> <span class="o">=</span> <span class="k">if</span> <span class="nx">rule</span><span class="p">.</span><span class="nx">isList</span> <span class="k">then</span> <span class="p">(</span><span class="nx">options</span><span class="p">[</span><span class="nx">rule</span><span class="p">.</span><span class="nx">name</span><span class="p">]</span> <span class="o">or</span> <span class="p">[]).</span><span class="nx">concat</span> <span class="nx">value</span> <span class="k">else</span> <span class="nx">value</span>
37  
-          <span class="nv">matchedRule = </span><span class="kc">yes</span>
38  
-          <span class="k">break</span>
39  
-      <span class="k">throw</span> <span class="k">new</span> <span class="nb">Error</span> <span class="s2">&quot;unrecognized option: #{arg}&quot;</span> <span class="k">if</span> <span class="nx">isOption</span> <span class="o">and</span> <span class="o">not</span> <span class="nx">matchedRule</span>
40  
-      <span class="k">if</span> <span class="o">not</span> <span class="nx">isOption</span>
41  
-        <span class="nv">options.arguments = </span><span class="nx">originalArgs</span><span class="p">[(</span><span class="nx">originalArgs</span><span class="p">.</span><span class="nx">indexOf</span> <span class="nx">arg</span><span class="p">)..]</span>
42  
-        <span class="k">break</span>
43  
-    <span class="nx">options</span></pre></div>             </td>           </tr>                               <tr id="section-4">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-4">&#182;</a>               </div>               <p>Return the help text for this <strong>OptionParser</strong>, listing and describing all
  33
+      <span class="nv">isOption = </span><span class="o">!!</span><span class="p">(</span><span class="nx">arg</span><span class="p">.</span><span class="nx">match</span><span class="p">(</span><span class="nx">LONG_FLAG</span><span class="p">)</span> <span class="o">or</span> <span class="nx">arg</span><span class="p">.</span><span class="nx">match</span><span class="p">(</span><span class="nx">SHORT_FLAG</span><span class="p">))</span></pre></div>             </td>           </tr>                               <tr id="section-4">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-4">&#182;</a>               </div>               <p>the CS option parser is a little odd; options after the first
  34
+non-option argument are treated as non-option arguments themselves</p>             </td>             <td class="code">               <div class="highlight"><pre>      <span class="nv">seenNonOptionArg = </span><span class="nx">options</span><span class="p">.</span><span class="nx">arguments</span><span class="p">.</span><span class="nx">length</span> <span class="o">&gt;</span> <span class="mi">0</span>
  35
+      <span class="nx">unless</span> <span class="nx">seenNonOptionArg</span>
  36
+        <span class="nv">matchedRule = </span><span class="kc">no</span>
  37
+        <span class="k">for</span> <span class="nx">rule</span> <span class="k">in</span> <span class="nx">@rules</span>
  38
+          <span class="k">if</span> <span class="nx">rule</span><span class="p">.</span><span class="nx">shortFlag</span> <span class="o">is</span> <span class="nx">arg</span> <span class="o">or</span> <span class="nx">rule</span><span class="p">.</span><span class="nx">longFlag</span> <span class="o">is</span> <span class="nx">arg</span>
  39
+            <span class="nv">value = </span><span class="kc">true</span>
  40
+            <span class="k">if</span> <span class="nx">rule</span><span class="p">.</span><span class="nx">hasArgument</span>
  41
+              <span class="nv">skippingArgument = </span><span class="kc">yes</span>
  42
+              <span class="nv">value = </span><span class="nx">args</span><span class="p">[</span><span class="nx">i</span> <span class="o">+</span> <span class="mi">1</span><span class="p">]</span>
  43
+            <span class="nx">options</span><span class="p">[</span><span class="nx">rule</span><span class="p">.</span><span class="nx">name</span><span class="p">]</span> <span class="o">=</span> <span class="k">if</span> <span class="nx">rule</span><span class="p">.</span><span class="nx">isList</span> <span class="k">then</span> <span class="p">(</span><span class="nx">options</span><span class="p">[</span><span class="nx">rule</span><span class="p">.</span><span class="nx">name</span><span class="p">]</span> <span class="o">or</span> <span class="p">[]).</span><span class="nx">concat</span> <span class="nx">value</span> <span class="k">else</span> <span class="nx">value</span>
  44
+            <span class="nv">matchedRule = </span><span class="kc">yes</span>
  45
+            <span class="k">break</span>
  46
+        <span class="k">throw</span> <span class="k">new</span> <span class="nb">Error</span> <span class="s2">&quot;unrecognized option: #{arg}&quot;</span> <span class="k">if</span> <span class="nx">isOption</span> <span class="o">and</span> <span class="o">not</span> <span class="nx">matchedRule</span>
  47
+      <span class="k">if</span> <span class="nx">seenNonOptionArg</span> <span class="o">or</span> <span class="o">not</span> <span class="nx">isOption</span>
  48
+        <span class="nx">options</span><span class="p">.</span><span class="nx">arguments</span><span class="p">.</span><span class="nx">push</span> <span class="nx">arg</span>
  49
+    <span class="nx">options</span></pre></div>             </td>           </tr>                               <tr id="section-5">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-5">&#182;</a>               </div>               <p>Return the help text for this <strong>OptionParser</strong>, listing and describing all
44 50
 of the valid options, for <code>--help</code> and such.</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">help: </span><span class="o">-&gt;</span>
45 51
     <span class="nv">lines = </span><span class="p">[]</span>
46 52
     <span class="nx">lines</span><span class="p">.</span><span class="nx">unshift</span> <span class="s2">&quot;#{@banner}\n&quot;</span> <span class="k">if</span> <span class="nx">@banner</span>
@@ -49,14 +55,14 @@
49 55
       <span class="nv">spaces  = </span><span class="k">if</span> <span class="nx">spaces</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="k">then</span> <span class="nb">Array</span><span class="p">(</span><span class="nx">spaces</span> <span class="o">+</span> <span class="mi">1</span><span class="p">).</span><span class="nx">join</span><span class="p">(</span><span class="s1">&#39; &#39;</span><span class="p">)</span> <span class="k">else</span> <span class="s1">&#39;&#39;</span>
50 56
       <span class="nv">letPart = </span><span class="k">if</span> <span class="nx">rule</span><span class="p">.</span><span class="nx">shortFlag</span> <span class="k">then</span> <span class="nx">rule</span><span class="p">.</span><span class="nx">shortFlag</span> <span class="o">+</span> <span class="s1">&#39;, &#39;</span> <span class="k">else</span> <span class="s1">&#39;    &#39;</span>
51 57
       <span class="nx">lines</span><span class="p">.</span><span class="nx">push</span> <span class="s1">&#39;  &#39;</span> <span class="o">+</span> <span class="nx">letPart</span> <span class="o">+</span> <span class="nx">rule</span><span class="p">.</span><span class="nx">longFlag</span> <span class="o">+</span> <span class="nx">spaces</span> <span class="o">+</span> <span class="nx">rule</span><span class="p">.</span><span class="nx">description</span>
52  
-    <span class="s2">&quot;\n#{ lines.join(&#39;\n&#39;) }\n&quot;</span></pre></div>             </td>           </tr>                               <tr id="section-5">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-5">&#182;</a>               </div>               <h2>Helpers</h2>             </td>             <td class="code">               <div class="highlight"><pre></pre></div>             </td>           </tr>                               <tr id="section-6">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-6">&#182;</a>               </div>               <p>Regex matchers for option flags.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">LONG_FLAG  = </span><span class="sr">/^(--\w[\w\-]+)/</span>
53  
-<span class="nv">SHORT_FLAG = </span><span class="sr">/^(-\w)/</span>
  58
+    <span class="s2">&quot;\n#{ lines.join(&#39;\n&#39;) }\n&quot;</span></pre></div>             </td>           </tr>                               <tr id="section-6">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-6">&#182;</a>               </div>               <h2>Helpers</h2>             </td>             <td class="code">               <div class="highlight"><pre></pre></div>             </td>           </tr>                               <tr id="section-7">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-7">&#182;</a>               </div>               <p>Regex matchers for option flags.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">LONG_FLAG  = </span><span class="sr">/^(--\w[\w\-]*)/</span>
  59
+<span class="nv">SHORT_FLAG = </span><span class="sr">/^(-\w)$/</span>
54 60
 <span class="nv">MULTI_FLAG = </span><span class="sr">/^-(\w{2,})/</span>
55  
-<span class="nv">OPTIONAL   = </span><span class="sr">/\[(\w+(\*?))\]/</span></pre></div>             </td>           </tr>                               <tr id="section-7">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-7">&#182;</a>               </div>               <p>Build and return the list of option rules. If the optional <em>short-flag</em> is
  61
+<span class="nv">OPTIONAL   = </span><span class="sr">/\[(\w+(\*?))\]/</span></pre></div>             </td>           </tr>                               <tr id="section-8">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-8">&#182;</a>               </div>               <p>Build and return the list of option rules. If the optional <em>short-flag</em> is
56 62
 unspecified, leave it out by padding with <code>null</code>.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">buildRules = </span><span class="nf">(rules) -&gt;</span>
57 63
   <span class="k">for</span> <span class="nx">tuple</span> <span class="k">in</span> <span class="nx">rules</span>
58 64
     <span class="nx">tuple</span><span class="p">.</span><span class="nx">unshift</span> <span class="kc">null</span> <span class="k">if</span> <span class="nx">tuple</span><span class="p">.</span><span class="nx">length</span> <span class="o">&lt;</span> <span class="mi">3</span>
59  
-    <span class="nx">buildRule</span> <span class="nx">tuple</span><span class="p">...</span></pre></div>             </td>           </tr>                               <tr id="section-8">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-8">&#182;</a>               </div>               <p>Build a rule from a <code>-o</code> short flag, a <code>--output [DIR]</code> long flag, and the
  65
+    <span class="nx">buildRule</span> <span class="nx">tuple</span><span class="p">...</span></pre></div>             </td>           </tr>                               <tr id="section-9">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-9">&#182;</a>               </div>               <p>Build a rule from a <code>-o</code> short flag, a <code>--output [DIR]</code> long flag, and the
60 66
 description of what the option does.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">buildRule = </span><span class="nf">(shortFlag, longFlag, description, options = {}) -&gt;</span>
61 67
   <span class="nv">match     = </span><span class="nx">longFlag</span><span class="p">.</span><span class="nx">match</span><span class="p">(</span><span class="nx">OPTIONAL</span><span class="p">)</span>
62 68
   <span class="nv">longFlag  = </span><span class="nx">longFlag</span><span class="p">.</span><span class="nx">match</span><span class="p">(</span><span class="nx">LONG_FLAG</span><span class="p">)[</span><span class="mi">1</span><span class="p">]</span>
@@ -67,9 +73,9 @@
67 73
     <span class="nv">description: </span> <span class="nx">description</span>
68 74
     <span class="nv">hasArgument: </span> <span class="o">!!</span><span class="p">(</span><span class="nx">match</span> <span class="o">and</span> <span class="nx">match</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
69 75
     <span class="nv">isList: </span>      <span class="o">!!</span><span class="p">(</span><span class="nx">match</span> <span class="o">and</span> <span class="nx">match</span><span class="p">[</span><span class="mi">2</span><span class="p">])</span>
70  
-  <span class="p">}</span></pre></div>             </td>           </tr>                               <tr id="section-9">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-9">&#182;</a>               </div>               <p>Normalize arguments by expanding merged flags into multiple flags. This allows
  76
+  <span class="p">}</span></pre></div>             </td>           </tr>                               <tr id="section-10">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-10">&#182;</a>               </div>               <p>Normalize arguments by expanding merged flags into multiple flags. This allows
71 77
 you to have <code>-wl</code> be the same as <code>--watch --lint</code>.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">normalizeArguments = </span><span class="nf">(args) -&gt;</span>
72  
-  <span class="nv">args = </span><span class="nx">args</span><span class="p">.</span><span class="nx">slice</span> <span class="mi">0</span>
  78
+  <span class="nv">args = </span><span class="nx">args</span><span class="p">[..]</span>
73 79
   <span class="nv">result = </span><span class="p">[]</span>
74 80
   <span class="k">for</span> <span class="nx">arg</span> <span class="k">in</span> <span class="nx">args</span>
75 81
     <span class="k">if</span> <span class="nv">match = </span><span class="nx">arg</span><span class="p">.</span><span class="nx">match</span> <span class="nx">MULTI_FLAG</span>
111  documentation/docs/repl.html
@@ -3,19 +3,45 @@
3 3
 Using it looks like this:</p>
4 4
 
5 5
 <pre><code>coffee&gt; console.log "#{num} bottles of beer" for num in [99..1]
6  
-</code></pre>             </td>             <td class="code">               <div class="highlight"><pre></pre></div>             </td>           </tr>                               <tr id="section-2">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-2">&#182;</a>               </div>               <p>Require the <strong>coffee-script</strong> module to get access to the compiler.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">CoffeeScript = </span><span class="nx">require</span> <span class="s1">&#39;./coffee-script&#39;</span>
  6
+</code></pre>             </td>             <td class="code">               <div class="highlight"><pre></pre></div>             </td>           </tr>                               <tr id="section-2">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-2">&#182;</a>               </div>               <p>Start by opening up <code>stdin</code> and <code>stdout</code>.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">stdin = </span><span class="nx">process</span><span class="p">.</span><span class="nx">openStdin</span><span class="p">()</span>
  7
+<span class="nv">stdout = </span><span class="nx">process</span><span class="p">.</span><span class="nx">stdout</span></pre></div>             </td>           </tr>                               <tr id="section-3">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-3">&#182;</a>               </div>               <p>Require the <strong>coffee-script</strong> module to get access to the compiler.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">CoffeeScript = </span><span class="nx">require</span> <span class="s1">&#39;./coffee-script&#39;</span>
7 8
 <span class="nv">readline     = </span><span class="nx">require</span> <span class="s1">&#39;readline&#39;</span>
8 9
 <span class="p">{</span><span class="nx">inspect</span><span class="p">}</span>    <span class="o">=</span> <span class="nx">require</span> <span class="s1">&#39;util&#39;</span>
9 10
 <span class="p">{</span><span class="nx">Script</span><span class="p">}</span>     <span class="o">=</span> <span class="nx">require</span> <span class="s1">&#39;vm&#39;</span>
10  
-<span class="nv">Module       = </span><span class="nx">require</span> <span class="s1">&#39;module&#39;</span></pre></div>             </td>           </tr>                               <tr id="section-3">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-3">&#182;</a>               </div>               <p>REPL Setup</p>             </td>             <td class="code">               <div class="highlight"><pre></pre></div>             </td>           </tr>                               <tr id="section-4">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-4">&#182;</a>               </div>               <p>Config</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">REPL_PROMPT = </span><span class="s1">&#39;coffee&gt; &#39;</span>
  11
+<span class="nv">Module       = </span><span class="nx">require</span> <span class="s1">&#39;module&#39;</span></pre></div>             </td>           </tr>                               <tr id="section-4">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-4">&#182;</a>               </div>               <p>REPL Setup</p>             </td>             <td class="code">               <div class="highlight"><pre></pre></div>             </td>           </tr>                               <tr id="section-5">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-5">&#182;</a>               </div>               <p>Config</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">REPL_PROMPT = </span><span class="s1">&#39;coffee&gt; &#39;</span>
  12
+<span class="nv">REPL_PROMPT_MULTILINE = </span><span class="s1">&#39;------&gt; &#39;</span>
11 13
 <span class="nv">REPL_PROMPT_CONTINUATION = </span><span class="s1">&#39;......&gt; &#39;</span>
12 14
 <span class="nv">enableColours = </span><span class="kc">no</span>
13 15
 <span class="nx">unless</span> <span class="nx">process</span><span class="p">.</span><span class="nx">platform</span> <span class="o">is</span> <span class="s1">&#39;win32&#39;</span>
14  
-  <span class="nv">enableColours = </span><span class="o">not</span> <span class="nx">process</span><span class="p">.</span><span class="nx">env</span><span class="p">.</span><span class="nx">NODE_DISABLE_COLORS</span></pre></div>             </td>           </tr>                               <tr id="section-5">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-5">&#182;</a>               </div>               <p>Start by opening up <code>stdin</code> and <code>stdout</code>.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">stdin = </span><span class="nx">process</span><span class="p">.</span><span class="nx">openStdin</span><span class="p">()</span>
15  
-<span class="nv">stdout = </span><span class="nx">process</span><span class="p">.</span><span class="nx">stdout</span></pre></div>             </td>           </tr>                               <tr id="section-6">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-6">&#182;</a>               </div>               <p>Log an error.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">error = </span><span class="nf">(err) -&gt;</span>
16  
-  <span class="nx">stdout</span><span class="p">.</span><span class="nx">write</span> <span class="p">(</span><span class="nx">err</span><span class="p">.</span><span class="nx">stack</span> <span class="o">or</span> <span class="nx">err</span><span class="p">.</span><span class="nx">toString</span><span class="p">())</span> <span class="o">+</span> <span class="s1">&#39;\n&#39;</span></pre></div>             </td>           </tr>                               <tr id="section-7">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-7">&#182;</a>               </div>               <p>The current backlog of multi-line code.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">backlog = </span><span class="s1">&#39;&#39;</span></pre></div>             </td>           </tr>                               <tr id="section-8">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-8">&#182;</a>               </div>               <p>The main REPL function. <strong>run</strong> is called every time a line of code is entered.
  16
+  <span class="nv">enableColours = </span><span class="o">not</span> <span class="nx">process</span><span class="p">.</span><span class="nx">env</span><span class="p">.</span><span class="nx">NODE_DISABLE_COLORS</span></pre></div>             </td>           </tr>                               <tr id="section-6">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-6">&#182;</a>               </div>               <p>Log an error.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">error = </span><span class="nf">(err) -&gt;</span>
  17
+  <span class="nx">stdout</span><span class="p">.</span><span class="nx">write</span> <span class="p">(</span><span class="nx">err</span><span class="p">.</span><span class="nx">stack</span> <span class="o">or</span> <span class="nx">err</span><span class="p">.</span><span class="nx">toString</span><span class="p">())</span> <span class="o">+</span> <span class="s1">&#39;\n&#39;</span></pre></div>             </td>           </tr>                               <tr id="section-7">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-7">&#182;</a>               </div>               <h1>Autocompletion</h1>             </td>             <td class="code">               <div class="highlight"><pre></pre></div>             </td>           </tr>                               <tr id="section-8">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-8">&#182;</a>               </div>               <p>Regexes to match complete-able bits of text.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">ACCESSOR  = </span><span class="sr">/\s*([\w\.]+)(?:\.(\w*))$/</span>
  18
+<span class="nv">SIMPLEVAR = </span><span class="sr">/(\w+)$/i</span></pre></div>             </td>           </tr>                               <tr id="section-9">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-9">&#182;</a>               </div>               <p>Returns a list of completions, and the completed text.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">autocomplete = </span><span class="nf">(text) -&gt;</span>
  19
+  <span class="nx">completeAttribute</span><span class="p">(</span><span class="nx">text</span><span class="p">)</span> <span class="o">or</span> <span class="nx">completeVariable</span><span class="p">(</span><span class="nx">text</span><span class="p">)</span> <span class="o">or</span> <span class="p">[[],</span> <span class="nx">text</span><span class="p">]</span></pre></div>             </td>           </tr>                               <tr id="section-10">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-10">&#182;</a>               </div>               <p>Attempt to autocomplete a chained dotted attribute: <code>one.two.three</code>.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">completeAttribute = </span><span class="nf">(text) -&gt;</span>
  20
+  <span class="k">if</span> <span class="nv">match = </span><span class="nx">text</span><span class="p">.</span><span class="nx">match</span> <span class="nx">ACCESSOR</span>
  21
+    <span class="p">[</span><span class="nx">all</span><span class="p">,</span> <span class="nx">obj</span><span class="p">,</span> <span class="nx">prefix</span><span class="p">]</span> <span class="o">=</span> <span class="nx">match</span>
  22
+    <span class="k">try</span>
  23
+      <span class="nv">val = </span><span class="nx">Script</span><span class="p">.</span><span class="nx">runInThisContext</span> <span class="nx">obj</span>
  24
+    <span class="k">catch</span> <span class="nx">error</span>
  25
+      <span class="k">return</span>
  26
+    <span class="nv">completions = </span><span class="nx">getCompletions</span> <span class="nx">prefix</span><span class="p">,</span> <span class="nb">Object</span><span class="p">.</span><span class="nx">getOwnPropertyNames</span> <span class="nb">Object</span> <span class="nx">val</span>
  27
+    <span class="p">[</span><span class="nx">completions</span><span class="p">,</span> <span class="nx">prefix</span><span class="p">]</span></pre></div>             </td>           </tr>                               <tr id="section-11">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-11">&#182;</a>               </div>               <p>Attempt to autocomplete an in-scope free variable: <code>one</code>.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">completeVariable = </span><span class="nf">(text) -&gt;</span>
  28
+  <span class="nv">free = </span><span class="nx">text</span><span class="p">.</span><span class="nx">match</span><span class="p">(</span><span class="nx">SIMPLEVAR</span><span class="p">)</span><span class="o">?</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
  29
+  <span class="nv">free = </span><span class="s2">&quot;&quot;</span> <span class="k">if</span> <span class="nx">text</span> <span class="o">is</span> <span class="s2">&quot;&quot;</span>
  30
+  <span class="k">if</span> <span class="nx">free</span><span class="o">?</span>
  31
+    <span class="nv">vars = </span><span class="nx">Script</span><span class="p">.</span><span class="nx">runInThisContext</span> <span class="s1">&#39;Object.getOwnPropertyNames(Object(this))&#39;</span>
  32
+    <span class="nv">keywords = </span><span class="p">(</span><span class="nx">r</span> <span class="k">for</span> <span class="nx">r</span> <span class="k">in</span> <span class="nx">CoffeeScript</span><span class="p">.</span><span class="nx">RESERVED</span> <span class="k">when</span> <span class="nx">r</span><span class="p">[..</span><span class="mi">1</span><span class="p">]</span> <span class="o">isnt</span> <span class="s1">&#39;__&#39;</span><span class="p">)</span>
  33
+    <span class="nv">possibilities = </span><span class="nx">vars</span><span class="p">.</span><span class="nx">concat</span> <span class="nx">keywords</span>
  34
+    <span class="nv">completions = </span><span class="nx">getCompletions</span> <span class="nx">free</span><span class="p">,</span> <span class="nx">possibilities</span>
  35
+    <span class="p">[</span><span class="nx">completions</span><span class="p">,</span> <span class="nx">free</span><span class="p">]</span></pre></div>             </td>           </tr>                               <tr id="section-12">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-12">&#182;</a>               </div>               <p>Return elements of candidates for which <code>prefix</code> is a prefix.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">getCompletions = </span><span class="nf">(prefix, candidates) -&gt;</span>
  36
+  <span class="p">(</span><span class="nx">el</span> <span class="k">for</span> <span class="nx">el</span> <span class="k">in</span> <span class="nx">candidates</span> <span class="k">when</span> <span class="nx">el</span><span class="p">.</span><span class="nx">indexOf</span><span class="p">(</span><span class="nx">prefix</span><span class="p">)</span> <span class="o">is</span> <span class="mi">0</span><span class="p">)</span></pre></div>             </td>           </tr>                               <tr id="section-13">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-13">&#182;</a>               </div>               <p>Make sure that uncaught exceptions don't kill the REPL.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nx">process</span><span class="p">.</span><span class="kc">on</span> <span class="s1">&#39;uncaughtException&#39;</span><span class="p">,</span> <span class="nx">error</span></pre></div>             </td>           </tr>                               <tr id="section-14">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-14">&#182;</a>               </div>               <p>The current backlog of multi-line code.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">backlog = </span><span class="s1">&#39;&#39;</span></pre></div>             </td>           </tr>                               <tr id="section-15">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-15">&#182;</a>               </div>               <p>The main REPL function. <strong>run</strong> is called every time a line of code is entered.
17 37
 Attempt to evaluate the command. If there's an exception, print it out instead
18 38
 of exiting.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">run = </span><span class="nf">(buffer) -&gt;</span>
  39
+  <span class="nv">buffer = </span><span class="nx">buffer</span><span class="p">.</span><span class="nx">replace</span> <span class="sr">/[\r\n]+$/</span><span class="p">,</span> <span class="s2">&quot;&quot;</span>
  40
+  <span class="k">if</span> <span class="nx">multilineMode</span>
  41
+    <span class="nx">backlog</span> <span class="o">+=</span> <span class="s2">&quot;#{buffer}\n&quot;</span>
  42
+    <span class="nx">repl</span><span class="p">.</span><span class="nx">setPrompt</span> <span class="nx">REPL_PROMPT_CONTINUATION</span>
  43
+    <span class="nx">repl</span><span class="p">.</span><span class="nx">prompt</span><span class="p">()</span>
  44
+    <span class="k">return</span>
19 45
   <span class="k">if</span> <span class="o">!</span><span class="nx">buffer</span><span class="p">.</span><span class="nx">toString</span><span class="p">().</span><span class="nx">trim</span><span class="p">()</span> <span class="o">and</span> <span class="o">!</span><span class="nx">backlog</span>
20 46
     <span class="nx">repl</span><span class="p">.</span><span class="nx">prompt</span><span class="p">()</span>
21 47
     <span class="k">return</span>
@@ -29,51 +55,70 @@
29 55
   <span class="nv">backlog = </span><span class="s1">&#39;&#39;</span>
30 56
   <span class="k">try</span>
31 57
     <span class="nv">_ = </span><span class="nx">global</span><span class="p">.</span><span class="nx">_</span>
32  
-    <span class="nv">returnValue = </span><span class="nx">CoffeeScript</span><span class="p">.</span><span class="nb">eval</span> <span class="s2">&quot;_=(#{code}\n)&quot;</span><span class="p">,</span> <span class="p">{</span>
  58
+    <span class="nv">returnValue = </span><span class="nx">CoffeeScript</span><span class="p">.</span><span class="nb">eval</span> <span class="s2">&quot;_=(undefined\n;#{code}\n)&quot;</span><span class="p">,</span> <span class="p">{</span>
33 59
       <span class="nv">filename: </span><span class="s1">&#39;repl&#39;</span>
34 60
       <span class="nv">modulename: </span><span class="s1">&#39;repl&#39;</span>
35 61
     <span class="p">}</span>
36 62
     <span class="k">if</span> <span class="nx">returnValue</span> <span class="o">is</span> <span class="kc">undefined</span>
37 63
       <span class="nv">global._ = </span><span class="nx">_</span>
38  
-    <span class="nx">process</span><span class="p">.</span><span class="nx">stdout</span><span class="p">.</span><span class="nx">write</span> <span class="nx">inspect</span><span class="p">(</span><span class="nx">returnValue</span><span class="p">,</span> <span class="kc">no</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="nx">enableColours</span><span class="p">)</span> <span class="o">+</span> <span class="s1">&#39;\n&#39;</span>
  64
+    <span class="nx">repl</span><span class="p">.</span><span class="nx">output</span><span class="p">.</span><span class="nx">write</span> <span class="s2">&quot;#{inspect returnValue, no, 2, enableColours}\n&quot;</span>
39 65
   <span class="k">catch</span> <span class="nx">err</span>
40 66
     <span class="nx">error</span> <span class="nx">err</span>
41  
-  <span class="nx">repl</span><span class="p">.</span><span class="nx">prompt</span><span class="p">()</span></pre></div>             </td>           </tr>                               <tr id="section-9">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-9">&#182;</a>               </div>               <h1>Autocompletion</h1>             </td>             <td class="code">               <div class="highlight"><pre></pre></div>             </td>           </tr>                               <tr id="section-10">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-10">&#182;</a>               </div>               <p>Regexes to match complete-able bits of text.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">ACCESSOR  = </span><span class="sr">/\s*([\w\.]+)(?:\.(\w*))$/</span>
42  
-<span class="nv">SIMPLEVAR = </span><span class="sr">/\s*(\w*)$/i</span></pre></div>             </td>           </tr>                               <tr id="section-11">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-11">&#182;</a>               </div>               <p>Returns a list of completions, and the completed text.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">autocomplete = </span><span class="nf">(text) -&gt;</span>
43  
-  <span class="nx">completeAttribute</span><span class="p">(</span><span class="nx">text</span><span class="p">)</span> <span class="o">or</span> <span class="nx">completeVariable</span><span class="p">(</span><span class="nx">text</span><span class="p">)</span> <span class="o">or</span> <span class="p">[[],</span> <span class="nx">text</span><span class="p">]</span></pre></div>             </td>           </tr>                               <tr id="section-12">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-12">&#182;</a>               </div>               <p>Attempt to autocomplete a chained dotted attribute: <code>one.two.three</code>.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">completeAttribute = </span><span class="nf">(text) -&gt;</span>
44  
-  <span class="k">if</span> <span class="nv">match = </span><span class="nx">text</span><span class="p">.</span><span class="nx">match</span> <span class="nx">ACCESSOR</span>
45  
-    <span class="p">[</span><span class="nx">all</span><span class="p">,</span> <span class="nx">obj</span><span class="p">,</span> <span class="nx">prefix</span><span class="p">]</span> <span class="o">=</span> <span class="nx">match</span>
46  
-    <span class="k">try</span>
47  
-      <span class="nv">val = </span><span class="nx">Script</span><span class="p">.</span><span class="nx">runInThisContext</span> <span class="nx">obj</span>
48  
-    <span class="k">catch</span> <span class="nx">error</span>
49  
-      <span class="k">return</span>
50  
-    <span class="nv">completions = </span><span class="nx">getCompletions</span> <span class="nx">prefix</span><span class="p">,</span> <span class="nb">Object</span><span class="p">.</span><span class="nx">getOwnPropertyNames</span> <span class="nx">val</span>
51  
-    <span class="p">[</span><span class="nx">completions</span><span class="p">,</span> <span class="nx">prefix</span><span class="p">]</span></pre></div>             </td>           </tr>                               <tr id="section-13">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-13">&#182;</a>               </div>               <p>Attempt to autocomplete an in-scope free variable: <code>one</code>.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">completeVariable = </span><span class="nf">(text) -&gt;</span>
52  
-  <span class="nv">free = </span><span class="p">(</span><span class="nx">text</span><span class="p">.</span><span class="nx">match</span> <span class="nx">SIMPLEVAR</span><span class="p">)</span><span class="o">?</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
53  
-  <span class="k">if</span> <span class="nx">free</span><span class="o">?</span>
54  
-    <span class="nv">vars = </span><span class="nx">Script</span><span class="p">.</span><span class="nx">runInThisContext</span> <span class="s1">&#39;Object.getOwnPropertyNames(this)&#39;</span>
55  
-    <span class="nv">keywords = </span><span class="p">(</span><span class="nx">r</span> <span class="k">for</span> <span class="nx">r</span> <span class="k">in</span> <span class="nx">CoffeeScript</span><span class="p">.</span><span class="nx">RESERVED</span> <span class="k">when</span> <span class="nx">r</span><span class="p">[</span><span class="mi">0</span><span class="p">..</span><span class="mi">1</span><span class="p">]</span> <span class="o">isnt</span> <span class="s1">&#39;__&#39;</span><span class="p">)</span>
56  
-    <span class="nv">possibilities = </span><span class="nx">vars</span><span class="p">.</span><span class="nx">concat</span> <span class="nx">keywords</span>
57  
-    <span class="nv">completions = </span><span class="nx">getCompletions</span> <span class="nx">free</span><span class="p">,</span> <span class="nx">possibilities</span>
58  
-    <span class="p">[</span><span class="nx">completions</span><span class="p">,</span> <span class="nx">free</span><span class="p">]</span></pre></div>             </td>           </tr>                               <tr id="section-14">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-14">&#182;</a>               </div>               <p>Return elements of candidates for which <code>prefix</code> is a prefix.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nv">getCompletions = </span><span class="nf">(prefix, candidates) -&gt;</span>
59  
-  <span class="p">(</span><span class="nx">el</span> <span class="k">for</span> <span class="nx">el</span> <span class="k">in</span> <span class="nx">candidates</span> <span class="k">when</span> <span class="nx">el</span><span class="p">.</span><span class="nx">indexOf</span><span class="p">(</span><span class="nx">prefix</span><span class="p">)</span> <span class="o">is</span> <span class="mi">0</span><span class="p">)</span></pre></div>             </td>           </tr>                               <tr id="section-15">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-15">&#182;</a>               </div>               <p>Make sure that uncaught exceptions don't kill the REPL.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nx">process</span><span class="p">.</span><span class="kc">on</span> <span class="s1">&#39;uncaughtException&#39;</span><span class="p">,</span> <span class="nx">error</span></pre></div>             </td>           </tr>                               <tr id="section-16">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-16">&#182;</a>               </div>               <p>Create the REPL by listening to <strong>stdin</strong>.</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="k">if</span> <span class="nx">readline</span><span class="p">.</span><span class="nx">createInterface</span><span class="p">.</span><span class="nx">length</span> <span class="o">&lt;</span> <span class="mi">3</span>
60  
-  <span class="nv">repl = </span><span class="nx">readline</span><span class="p">.</span><span class="nx">createInterface</span> <span class="nx">stdin</span><span class="p">,</span> <span class="nx">autocomplete</span>
61  
-  <span class="nx">stdin</span><span class="p">.</span><span class="kc">on</span> <span class="s1">&#39;data&#39;</span><span class="p">,</span> <span class="nf">(buffer) -&gt;</span> <span class="nx">repl</span><span class="p">.</span><span class="nx">write</span> <span class="nx">buffer</span>
62  
-<span class="k">else</span>
63  
-  <span class="nv">repl = </span><span class="nx">readline</span><span class="p">.</span><span class="nx">createInterface</span> <span class="nx">stdin</span><span class="p">,</span> <span class="nx">stdout</span><span class="p">,</span> <span class="nx">autocomplete</span>
  67
+  <span class="nx">repl</span><span class="p">.</span><span class="nx">prompt</span><span class="p">()</span>
  68
+
  69
+<span class="k">if</span> <span class="nx">stdin</span><span class="p">.</span><span class="nx">readable</span></pre></div>             </td>           </tr>                               <tr id="section-16">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-16">&#182;</a>               </div>               <p>handle piped input</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">pipedInput = </span><span class="s1">&#39;&#39;</span>
  70
+  <span class="nv">repl =</span>
  71
+    <span class="nv">prompt: </span><span class="o">-&gt;</span> <span class="nx">stdout</span><span class="p">.</span><span class="nx">write</span> <span class="nx">@_prompt</span>
  72
+    <span class="nv">setPrompt: </span><span class="nf">(p) -&gt;</span> <span class="vi">@_prompt = </span><span class="nx">p</span>
  73
+    <span class="nv">input: </span><span class="nx">stdin</span>
  74
+    <span class="nv">output: </span><span class="nx">stdout</span>
  75
+    <span class="kc">on</span><span class="o">:</span> <span class="o">-&gt;</span>
  76
+  <span class="nx">stdin</span><span class="p">.</span><span class="kc">on</span> <span class="s1">&#39;data&#39;</span><span class="p">,</span> <span class="nf">(chunk) -&gt;</span>
  77
+    <span class="nx">pipedInput</span> <span class="o">+=</span> <span class="nx">chunk</span>
  78
+  <span class="nx">stdin</span><span class="p">.</span><span class="kc">on</span> <span class="s1">&#39;end&#39;</span><span class="p">,</span> <span class="o">-&gt;</span>
  79
+    <span class="k">for</span> <span class="nx">line</span> <span class="k">in</span> <span class="nx">pipedInput</span><span class="p">.</span><span class="nx">trim</span><span class="p">().</span><span class="nx">split</span> <span class="s2">&quot;\n&quot;</span>
  80
+      <span class="nx">stdout</span><span class="p">.</span><span class="nx">write</span> <span class="s2">&quot;#{line}\n&quot;</span>
  81
+      <span class="nx">run</span> <span class="nx">line</span>
  82
+    <span class="nx">stdout</span><span class="p">.</span><span class="nx">write</span> <span class="s1">&#39;\n&#39;</span>
  83
+    <span class="nx">process</span><span class="p">.</span><span class="nx">exit</span> <span class="mi">0</span>
  84
+<span class="k">else</span></pre></div>             </td>           </tr>                               <tr id="section-17">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-17">&#182;</a>               </div>               <p>Create the REPL by listening to <strong>stdin</strong>.</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="k">if</span> <span class="nx">readline</span><span class="p">.</span><span class="nx">createInterface</span><span class="p">.</span><span class="nx">length</span> <span class="o">&lt;</span> <span class="mi">3</span>
  85
+    <span class="nv">repl = </span><span class="nx">readline</span><span class="p">.</span><span class="nx">createInterface</span> <span class="nx">stdin</span><span class="p">,</span> <span class="nx">autocomplete</span>
  86
+    <span class="nx">stdin</span><span class="p">.</span><span class="kc">on</span> <span class="s1">&#39;data&#39;</span><span class="p">,</span> <span class="nf">(buffer) -&gt;</span> <span class="nx">repl</span><span class="p">.</span><span class="nx">write</span> <span class="nx">buffer</span>
  87
+  <span class="k">else</span>
  88
+    <span class="nv">repl = </span><span class="nx">readline</span><span class="p">.</span><span class="nx">createInterface</span> <span class="nx">stdin</span><span class="p">,</span> <span class="nx">stdout</span><span class="p">,</span> <span class="nx">autocomplete</span>
  89
+
  90
+<span class="nv">multilineMode = </span><span class="kc">off</span></pre></div>             </td>           </tr>                               <tr id="section-18">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-18">&#182;</a>               </div>               <p>Handle multi-line mode switch</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nx">repl</span><span class="p">.</span><span class="nx">input</span><span class="p">.</span><span class="kc">on</span> <span class="s1">&#39;keypress&#39;</span><span class="p">,</span> <span class="nf">(char, key) -&gt;</span></pre></div>             </td>           </tr>                               <tr id="section-19">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-19">&#182;</a>               </div>               <p>test for Ctrl-v</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="k">return</span> <span class="nx">unless</span> <span class="nx">key</span> <span class="o">and</span> <span class="nx">key</span><span class="p">.</span><span class="nx">ctrl</span> <span class="o">and</span> <span class="o">not</span> <span class="nx">key</span><span class="p">.</span><span class="nx">meta</span> <span class="o">and</span> <span class="o">not</span> <span class="nx">key</span><span class="p">.</span><span class="nx">shift</span> <span class="o">and</span> <span class="nx">key</span><span class="p">.</span><span class="nx">name</span> <span class="o">is</span> <span class="s1">&#39;v&#39;</span>
  91
+  <span class="nv">cursorPos = </span><span class="nx">repl</span><span class="p">.</span><span class="nx">cursor</span>
  92
+  <span class="nx">repl</span><span class="p">.</span><span class="nx">output</span><span class="p">.</span><span class="nx">cursorTo</span> <span class="mi">0</span>
  93
+  <span class="nx">repl</span><span class="p">.</span><span class="nx">output</span><span class="p">.</span><span class="nx">clearLine</span> <span class="mi">1</span>
  94
+  <span class="nv">multilineMode = </span><span class="o">not</span> <span class="nx">multilineMode</span>
  95
+  <span class="nx">repl</span><span class="p">.</span><span class="nx">_line</span><span class="p">()</span> <span class="k">if</span> <span class="o">not</span> <span class="nx">multilineMode</span> <span class="o">and</span> <span class="nx">backlog</span>
  96
+  <span class="nv">backlog = </span><span class="s1">&#39;&#39;</span>
  97
+  <span class="nx">repl</span><span class="p">.</span><span class="nx">setPrompt</span> <span class="p">(</span><span class="nv">newPrompt = </span><span class="k">if</span> <span class="nx">multilineMode</span> <span class="k">then</span> <span class="nx">REPL_PROMPT_MULTILINE</span> <span class="k">else</span> <span class="nx">REPL_PROMPT</span><span class="p">)</span>
  98
+  <span class="nx">repl</span><span class="p">.</span><span class="nx">prompt</span><span class="p">()</span>
  99
+  <span class="nx">repl</span><span class="p">.</span><span class="nx">output</span><span class="p">.</span><span class="nx">cursorTo</span> <span class="nx">newPrompt</span><span class="p">.</span><span class="nx">length</span> <span class="o">+</span> <span class="p">(</span><span class="nv">repl.cursor = </span><span class="nx">cursorPos</span><span class="p">)</span></pre></div>             </td>           </tr>                               <tr id="section-20">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-20">&#182;</a>               </div>               <p>Handle Ctrl-d press at end of last line in multiline mode</p>             </td>             <td class="code">               <div class="highlight"><pre><span class="nx">repl</span><span class="p">.</span><span class="nx">input</span><span class="p">.</span><span class="kc">on</span> <span class="s1">&#39;keypress&#39;</span><span class="p">,</span> <span class="nf">(char, key) -&gt;</span>
  100
+  <span class="k">return</span> <span class="nx">unless</span> <span class="nx">multilineMode</span> <span class="o">and</span> <span class="nx">repl</span><span class="p">.</span><span class="nx">line</span></pre></div>             </td>           </tr>                               <tr id="section-21">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-21">&#182;</a>               </div>               <p>test for Ctrl-d</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="k">return</span> <span class="nx">unless</span> <span class="nx">key</span> <span class="o">and</span> <span class="nx">key</span><span class="p">.</span><span class="nx">ctrl</span> <span class="o">and</span> <span class="o">not</span> <span class="nx">key</span><span class="p">.</span><span class="nx">meta</span> <span class="o">and</span> <span class="o">not</span> <span class="nx">key</span><span class="p">.</span><span class="nx">shift</span> <span class="o">and</span> <span class="nx">key</span><span class="p">.</span><span class="nx">name</span> <span class="o">is</span> <span class="s1">&#39;d&#39;</span>
  101
+  <span class="nv">multilineMode = </span><span class="kc">off</span>
  102
+  <span class="nx">repl</span><span class="p">.</span><span class="nx">_line</span><span class="p">()</span>
64 103
 
65 104
 <span class="nx">repl</span><span class="p">.</span><span class="kc">on</span> <span class="s1">&#39;attemptClose&#39;</span><span class="p">,</span> <span class="o">-&gt;</span>
  105
+  <span class="k">if</span> <span class="nx">multilineMode</span>
  106
+    <span class="nv">multilineMode = </span><span class="kc">off</span>
  107
+    <span class="nx">repl</span><span class="p">.</span><span class="nx">output</span><span class="p">.</span><span class="nx">cursorTo</span> <span class="mi">0</span>
  108
+    <span class="nx">repl</span><span class="p">.</span><span class="nx">output</span><span class="p">.</span><span class="nx">clearLine</span> <span class="mi">1</span>
  109
+    <span class="nx">repl</span><span class="p">.</span><span class="nx">_onLine</span> <span class="nx">repl</span><span class="p">.</span><span class="nx">line</span>
  110
+    <span class="k">return</span>
66 111
   <span class="k">if</span> <span class="nx">backlog</span>
67 112
     <span class="nv">backlog = </span><span class="s1">&#39;&#39;</span>
68  
-    <span class="nx">process</span><span class="p">.</span><span class="nx">stdout</span><span class="p">.</span><span class="nx">write</span> <span class="s1">&#39;\n&#39;</span>
  113
+    <span class="nx">repl</span><span class="p">.</span><span class="nx">output</span><span class="p">.</span><span class="nx">write</span> <span class="s1">&#39;\n&#39;</span>
69 114
     <span class="nx">repl</span><span class="p">.</span><span class="nx">setPrompt</span> <span class="nx">REPL_PROMPT</span>
70 115
     <span class="nx">repl</span><span class="p">.</span><span class="nx">prompt</span><span class="p">()</span>
71 116
   <span class="k">else</span>
72 117
     <span class="nx">repl</span><span class="p">.</span><span class="nx">close</span><span class="p">()</span>
73 118
 
74 119
 <span class="nx">repl</span><span class="p">.</span><span class="kc">on</span> <span class="s1">&#39;close&#39;</span><span class="p">,</span> <span class="o">-&gt;</span>
75  
-  <span class="nx">process</span><span class="p">.</span><span class="nx">stdout</span><span class="p">.</span><span class="nx">write</span> <span class="s1">&#39;\n&#39;</span>
76  
-  <span class="nx">stdin</span><span class="p">.</span><span class="nx">destroy</span><span class="p">()</span>
  120
+  <span class="nx">repl</span><span class="p">.</span><span class="nx">output</span><span class="p">.</span><span class="nx">write</span> <span class="s1">&#39;\n&#39;</span>
  121
+  <span class="nx">repl</span><span class="p">.</span><span class="nx">input</span><span class="p">.</span><span class="nx">destroy</span><span class="p">()</span>
77 122
 
78 123
 <span class="nx">repl</span><span class="p">.</span><span class="kc">on</span> <span class="s1">&#39;line&#39;</span><span class="p">,</span> <span class="nx">run</span>
79 124
 
91  documentation/docs/rewriter.html
@@ -50,52 +50,51 @@
50 50
       <span class="mi">0</span></pre></div>             </td>           </tr>                               <tr id="section-8">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-8">&#182;</a>               </div>               <p>The lexer has tagged the opening parenthesis of a method call. Match it with
51 51
 its paired close. We have the mis-nested outdent case included here for
52 52
 calls that close on the same line, just before their outdent.</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">closeOpenCalls: </span><span class="o">-&gt;</span>
53  
-    
  53
+
54 54
     <span class="nv">condition = </span><span class="nf">(token, i) -&gt;</span>
55 55
       <span class="nx">token</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="k">in</span> <span class="p">[</span><span class="s1">&#39;)&#39;</span><span class="p">,</span> <span class="s1">&#39;CALL_END&#39;</span><span class="p">]</span> <span class="o">or</span>
56 56
       <span class="nx">token</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">is</span> <span class="s1">&#39;OUTDENT&#39;</span> <span class="o">and</span> <span class="nx">@tag</span><span class="p">(</span><span class="nx">i</span> <span class="o">-</span> <span class="mi">1</span><span class="p">)</span> <span class="o">is</span> <span class="s1">&#39;)&#39;</span>
57  
-      
  57
+
58 58
     <span class="nv">action = </span><span class="nf">(token, i) -&gt;</span>
59 59
       <span class="nx">@tokens</span><span class="p">[</span><span class="k">if</span> <span class="nx">token</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">is</span> <span class="s1">&#39;OUTDENT&#39;</span> <span class="k">then</span> <span class="nx">i</span> <span class="o">-</span> <span class="mi">1</span> <span class="k">else</span> <span class="nx">i</span><span class="p">][</span><span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;CALL_END&#39;</span>
60  
-      
  60
+
61 61
     <span class="nx">@scanTokens</span> <span class="nf">(token, i) -&gt;</span>
62 62
       <span class="nx">@detectEnd</span> <span class="nx">i</span> <span class="o">+</span> <span class="mi">1</span><span class="p">,</span> <span class="nx">condition</span><span class="p">,</span> <span class="nx">action</span> <span class="k">if</span> <span class="nx">token</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">is</span> <span class="s1">&#39;CALL_START&#39;</span>
63 63
       <span class="mi">1</span></pre></div>             </td>           </tr>                               <tr id="section-9">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-9">&#182;</a>               </div>               <p>The lexer has tagged the opening parenthesis of an indexing operation call.
64 64
 Match it with its paired close.</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="nv">closeOpenIndexes: </span><span class="o">-&gt;</span>
65  
-    
66  
-    <span class="nv">condition = </span><span class="nf">(token, i) -&gt;</span> 
  65
+
  66
+    <span class="nv">condition = </span><span class="nf">(token, i) -&gt;</span>
67 67
       <span class="nx">token</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="k">in</span> <span class="p">[</span><span class="s1">&#39;]&#39;</span><span class="p">,</span> <span class="s1">&#39;INDEX_END&#39;</span><span class="p">]</span>
68  
-      
69  
-    <span class="nv">action = </span><span class="nf">(token, i) -&gt;</span> 
  68
+
  69
+    <span class="nv">action = </span><span class="nf">(token, i) -&gt;</span>
70 70
       <span class="nx">token</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;INDEX_END&#39;</span>
71  
-      
  71
+
72 72