Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 533ad8a

Browse files
committed
CoffeeScript 1.9.1
1 parent 1961f06 commit 533ad8a

74 files changed

Lines changed: 738 additions & 586 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "coffee-script",
3-
"version": "1.9.0",
3+
"version": "1.9.1",
44
"main": [
55
"lib/coffee-script/coffee-script.js"
66
],

documentation/docs/coffee-script.html

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ <h1>coffee-script.coffee</h1>
144144

145145
</div>
146146

147-
<div class="content"><div class='highlight'><pre><span class="hljs-built_in">exports</span>.VERSION = <span class="hljs-string">'1.9.0'</span>
147+
<div class="content"><div class='highlight'><pre><span class="hljs-built_in">exports</span>.VERSION = <span class="hljs-string">'1.9.1'</span>
148148

149149
<span class="hljs-built_in">exports</span>.FILE_EXTENSIONS = [<span class="hljs-string">'.coffee'</span>, <span class="hljs-string">'.litcoffee'</span>, <span class="hljs-string">'.coffee.md'</span>]</pre></div></div>
150150

@@ -222,14 +222,12 @@ <h1>coffee-script.coffee</h1>
222222
<a class="pilcrow" href="#section-6">&#182;</a>
223223
</div>
224224
<p>Pass a list of referenced variables, so that generated variables won’t get
225-
the same name. Since all generated variables start with an underscore only
226-
referenced variables also starting with an underscore are passed, as an
227-
optimization.</p>
225+
the same name.</p>
228226

229227
</div>
230228

231229
<div class="content"><div class='highlight'><pre> options.referencedVars = (
232-
token[<span class="hljs-number">1</span>] <span class="hljs-keyword">for</span> token <span class="hljs-keyword">in</span> tokens <span class="hljs-keyword">when</span> token.variable <span class="hljs-keyword">and</span> token[<span class="hljs-number">1</span>].charAt(<span class="hljs-number">0</span>) <span class="hljs-keyword">is</span> <span class="hljs-string">'_'</span>
230+
token[<span class="hljs-number">1</span>] <span class="hljs-keyword">for</span> token <span class="hljs-keyword">in</span> tokens <span class="hljs-keyword">when</span> token.variable
233231
)
234232

235233
fragments = parser.parse(tokens).compileToFragments options
@@ -639,12 +637,15 @@ <h1>coffee-script.coffee</h1>
639637
<div class="content"><div class='highlight'><pre> {errorToken, tokens} = parser
640638
[errorTag, errorText, errorLoc] = errorToken
641639

642-
errorText = <span class="hljs-keyword">if</span> errorToken <span class="hljs-keyword">is</span> tokens[tokens.length - <span class="hljs-number">1</span>]
643-
<span class="hljs-string">'end of input'</span>
644-
<span class="hljs-keyword">else</span> <span class="hljs-keyword">if</span> errorTag <span class="hljs-keyword">in</span> [<span class="hljs-string">'INDENT'</span>, <span class="hljs-string">'OUTDENT'</span>]
645-
<span class="hljs-string">'indentation'</span>
646-
<span class="hljs-keyword">else</span>
647-
helpers.nameWhitespaceCharacter errorText</pre></div></div>
640+
errorText = <span class="hljs-keyword">switch</span>
641+
<span class="hljs-keyword">when</span> errorToken <span class="hljs-keyword">is</span> tokens[tokens.length - <span class="hljs-number">1</span>]
642+
<span class="hljs-string">'end of input'</span>
643+
<span class="hljs-keyword">when</span> errorTag <span class="hljs-keyword">in</span> [<span class="hljs-string">'INDENT'</span>, <span class="hljs-string">'OUTDENT'</span>]
644+
<span class="hljs-string">'indentation'</span>
645+
<span class="hljs-keyword">when</span> errorTag <span class="hljs-keyword">in</span> [<span class="hljs-string">'IDENTIFIER'</span>, <span class="hljs-string">'NUMBER'</span>, <span class="hljs-string">'STRING'</span>, <span class="hljs-string">'STRING_START'</span>, <span class="hljs-string">'REGEX'</span>, <span class="hljs-string">'REGEX_START'</span>]
646+
errorTag.replace(<span class="hljs-regexp">/_START$/</span>, <span class="hljs-string">''</span>).toLowerCase()
647+
<span class="hljs-keyword">else</span>
648+
helpers.nameWhitespaceCharacter errorText</pre></div></div>
648649

649650
</li>
650651

documentation/docs/command.html

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,8 @@ <h1>command.coffee</h1>
236236
sourceCode = []
237237
notSources = {}
238238
watchedDirs = {}
239-
optionParser = <span class="hljs-literal">null</span></pre></div></div>
239+
optionParser = <span class="hljs-literal">null</span>
240+
jsToSources = {}</pre></div></div>
240241

241242
</li>
242243

@@ -675,6 +676,12 @@ <h1>command.coffee</h1>
675676
<div class="content"><div class='highlight'><pre><span class="hljs-function"><span class="hljs-title">writeJs</span> = <span class="hljs-params">(base, sourcePath, js, jsPath, generatedSourceMap = <span class="hljs-literal">null</span>)</span> -&gt;</span>
676677
sourceMapPath = outputPath sourcePath, base, <span class="hljs-string">".js.map"</span>
677678
jsDir = path.dirname jsPath
679+
<span class="hljs-keyword">if</span> jsPath <span class="hljs-keyword">of</span> jsToSources
680+
printLine <span class="hljs-string">"Error: The two following source files have the same output file:"</span>
681+
printLine <span class="hljs-string">" "</span> + jsToSources[jsPath]
682+
printLine <span class="hljs-string">" "</span> + sourcePath
683+
process.exit <span class="hljs-number">1</span>
684+
jsToSources[jsPath] = sourcePath
678685
<span class="hljs-function"><span class="hljs-title">compile</span> = -&gt;</span>
679686
<span class="hljs-keyword">if</span> opts.compile
680687
js = <span class="hljs-string">' '</span> <span class="hljs-keyword">if</span> js.length &lt;= <span class="hljs-number">0</span>

documentation/docs/grammar.html

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,17 @@ <h2 id="grammatical-rules">Grammatical Rules</h2>
460460

461461
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">AlphaNumeric</span>: [
462462
o <span class="hljs-string">'NUMBER'</span>,<span class="hljs-function"> -&gt;</span> <span class="hljs-keyword">new</span> Literal $<span class="hljs-number">1</span>
463+
o <span class="hljs-string">'String'</span>
464+
]
465+
466+
<span class="hljs-attribute">String</span>: [
463467
o <span class="hljs-string">'STRING'</span>,<span class="hljs-function"> -&gt;</span> <span class="hljs-keyword">new</span> Literal $<span class="hljs-number">1</span>
468+
o <span class="hljs-string">'STRING_START Body STRING_END'</span>,<span class="hljs-function"> -&gt;</span> <span class="hljs-keyword">new</span> Parens $<span class="hljs-number">2</span>
469+
]
470+
471+
<span class="hljs-attribute">Regex</span>: [
472+
o <span class="hljs-string">'REGEX'</span>,<span class="hljs-function"> -&gt;</span> <span class="hljs-keyword">new</span> Literal $<span class="hljs-number">1</span>
473+
o <span class="hljs-string">'REGEX_START Invocation REGEX_END'</span>,<span class="hljs-function"> -&gt;</span> $<span class="hljs-number">2</span>
464474
]</pre></div></div>
465475

466476
</li>
@@ -480,7 +490,7 @@ <h2 id="grammatical-rules">Grammatical Rules</h2>
480490
<div class="content"><div class='highlight'><pre> <span class="hljs-attribute">Literal</span>: [
481491
o <span class="hljs-string">'AlphaNumeric'</span>
482492
o <span class="hljs-string">'JS'</span>,<span class="hljs-function"> -&gt;</span> <span class="hljs-keyword">new</span> Literal $<span class="hljs-number">1</span>
483-
o <span class="hljs-string">'REGEX'</span>,<span class="hljs-function"> -&gt;</span> <span class="hljs-keyword">new</span> Literal $<span class="hljs-number">1</span>
493+
o <span class="hljs-string">'Regex'</span>
484494
o <span class="hljs-string">'DEBUGGER'</span>,<span class="hljs-function"> -&gt;</span> <span class="hljs-keyword">new</span> Literal $<span class="hljs-number">1</span>
485495
o <span class="hljs-string">'UNDEFINED'</span>,<span class="hljs-function"> -&gt;</span> <span class="hljs-keyword">new</span> Undefined
486496
o <span class="hljs-string">'NULL'</span>,<span class="hljs-function"> -&gt;</span> <span class="hljs-keyword">new</span> Null

documentation/docs/helpers.html

Lines changed: 26 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -311,21 +311,6 @@ <h1>helpers.coffee</h1>
311311
<div class="pilwrap ">
312312
<a class="pilcrow" href="#section-12">&#182;</a>
313313
</div>
314-
<p>Gets the last item of an array(-like) object.</p>
315-
316-
</div>
317-
318-
<div class="content"><div class='highlight'><pre><span class="hljs-built_in">exports</span>.last = <span class="hljs-function"><span class="hljs-title">last</span> = <span class="hljs-params">(array, back)</span> -&gt;</span> array[array.length - (back <span class="hljs-keyword">or</span> <span class="hljs-number">0</span>) - <span class="hljs-number">1</span>]</pre></div></div>
319-
320-
</li>
321-
322-
323-
<li id="section-13">
324-
<div class="annotation">
325-
326-
<div class="pilwrap ">
327-
<a class="pilcrow" href="#section-13">&#182;</a>
328-
</div>
329314
<p>Typical Array::some</p>
330315

331316
</div>
@@ -337,11 +322,11 @@ <h1>helpers.coffee</h1>
337322
</li>
338323

339324

340-
<li id="section-14">
325+
<li id="section-13">
341326
<div class="annotation">
342327

343328
<div class="pilwrap ">
344-
<a class="pilcrow" href="#section-14">&#182;</a>
329+
<a class="pilcrow" href="#section-13">&#182;</a>
345330
</div>
346331
<p>Simple function for inverting Literate CoffeeScript code by putting the
347332
documentation in comments, producing a string of CoffeeScript code that
@@ -363,11 +348,11 @@ <h1>helpers.coffee</h1>
363348
</li>
364349

365350

366-
<li id="section-15">
351+
<li id="section-14">
367352
<div class="annotation">
368353

369354
<div class="pilwrap ">
370-
<a class="pilcrow" href="#section-15">&#182;</a>
355+
<a class="pilcrow" href="#section-14">&#182;</a>
371356
</div>
372357
<p>Merge two jison-style location data objects together.
373358
If <code>last</code> is not provided, this will simply return <code>first</code>.</p>
@@ -386,11 +371,11 @@ <h1>helpers.coffee</h1>
386371
</li>
387372

388373

389-
<li id="section-16">
374+
<li id="section-15">
390375
<div class="annotation">
391376

392377
<div class="pilwrap ">
393-
<a class="pilcrow" href="#section-16">&#182;</a>
378+
<a class="pilcrow" href="#section-15">&#182;</a>
394379
</div>
395380
<p>This returns a function which takes an object as a parameter, and if that
396381
object is an AST node, updates that object’s locationData.
@@ -408,11 +393,11 @@ <h1>helpers.coffee</h1>
408393
</li>
409394

410395

411-
<li id="section-17">
396+
<li id="section-16">
412397
<div class="annotation">
413398

414399
<div class="pilwrap ">
415-
<a class="pilcrow" href="#section-17">&#182;</a>
400+
<a class="pilcrow" href="#section-16">&#182;</a>
416401
</div>
417402
<p>Convert jison location data to a string.
418403
<code>obj</code> can be a token, or a locationData.</p>
@@ -432,11 +417,11 @@ <h1>helpers.coffee</h1>
432417
</li>
433418

434419

435-
<li id="section-18">
420+
<li id="section-17">
436421
<div class="annotation">
437422

438423
<div class="pilwrap ">
439-
<a class="pilcrow" href="#section-18">&#182;</a>
424+
<a class="pilcrow" href="#section-17">&#182;</a>
440425
</div>
441426
<p>A <code>.coffee.md</code> compatible version of <code>basename</code>, that returns the file sans-extension.</p>
442427

@@ -455,11 +440,11 @@ <h1>helpers.coffee</h1>
455440
</li>
456441

457442

458-
<li id="section-19">
443+
<li id="section-18">
459444
<div class="annotation">
460445

461446
<div class="pilwrap ">
462-
<a class="pilcrow" href="#section-19">&#182;</a>
447+
<a class="pilcrow" href="#section-18">&#182;</a>
463448
</div>
464449
<p>Determine if a filename represents a CoffeeScript file.</p>
465450

@@ -470,11 +455,11 @@ <h1>helpers.coffee</h1>
470455
</li>
471456

472457

473-
<li id="section-20">
458+
<li id="section-19">
474459
<div class="annotation">
475460

476461
<div class="pilwrap ">
477-
<a class="pilcrow" href="#section-20">&#182;</a>
462+
<a class="pilcrow" href="#section-19">&#182;</a>
478463
</div>
479464
<p>Determine if a filename represents a Literate CoffeeScript file.</p>
480465

@@ -485,11 +470,11 @@ <h1>helpers.coffee</h1>
485470
</li>
486471

487472

488-
<li id="section-21">
473+
<li id="section-20">
489474
<div class="annotation">
490475

491476
<div class="pilwrap ">
492-
<a class="pilcrow" href="#section-21">&#182;</a>
477+
<a class="pilcrow" href="#section-20">&#182;</a>
493478
</div>
494479
<p>Throws a SyntaxError from a given location.
495480
The error’s <code>toString</code> will return an error message following the “standard”
@@ -506,11 +491,11 @@ <h1>helpers.coffee</h1>
506491
</li>
507492

508493

509-
<li id="section-22">
494+
<li id="section-21">
510495
<div class="annotation">
511496

512497
<div class="pilwrap ">
513-
<a class="pilcrow" href="#section-22">&#182;</a>
498+
<a class="pilcrow" href="#section-21">&#182;</a>
514499
</div>
515500
<p>Instead of showing the compiler’s stacktrace, show our custom error message
516501
(this is useful when the error bubbles up in Node.js applications that
@@ -525,11 +510,11 @@ <h1>helpers.coffee</h1>
525510
</li>
526511

527512

528-
<li id="section-23">
513+
<li id="section-22">
529514
<div class="annotation">
530515

531516
<div class="pilwrap ">
532-
<a class="pilcrow" href="#section-23">&#182;</a>
517+
<a class="pilcrow" href="#section-22">&#182;</a>
533518
</div>
534519
<p>Update a compiler SyntaxError with source code information if it didn’t have
535520
it already.</p>
@@ -541,11 +526,11 @@ <h1>helpers.coffee</h1>
541526
</li>
542527

543528

544-
<li id="section-24">
529+
<li id="section-23">
545530
<div class="annotation">
546531

547532
<div class="pilwrap ">
548-
<a class="pilcrow" href="#section-24">&#182;</a>
533+
<a class="pilcrow" href="#section-23">&#182;</a>
549534
</div>
550535
<p>Avoid screwing up the <code>stack</code> property of other errors (i.e. possible bugs).</p>
551536

@@ -571,11 +556,11 @@ <h1>helpers.coffee</h1>
571556
</li>
572557

573558

574-
<li id="section-25">
559+
<li id="section-24">
575560
<div class="annotation">
576561

577562
<div class="pilwrap ">
578-
<a class="pilcrow" href="#section-25">&#182;</a>
563+
<a class="pilcrow" href="#section-24">&#182;</a>
579564
</div>
580565
<p>Show only the first line on multi-line errors.</p>
581566

@@ -587,11 +572,11 @@ <h1>helpers.coffee</h1>
587572
</li>
588573

589574

590-
<li id="section-26">
575+
<li id="section-25">
591576
<div class="annotation">
592577

593578
<div class="pilwrap ">
594-
<a class="pilcrow" href="#section-26">&#182;</a>
579+
<a class="pilcrow" href="#section-25">&#182;</a>
595580
</div>
596581
<p>Check to see if we’re running on a color-enabled TTY.</p>
597582

0 commit comments

Comments
 (0)