Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/jashkenas/coffee-script
Browse files Browse the repository at this point in the history
Conflicts:
	src/coffee-script.coffee
	src/nodes.coffee
  • Loading branch information
falsecz committed Apr 17, 2012
2 parents cbd343f + eabcb2c commit f0d00f4
Show file tree
Hide file tree
Showing 84 changed files with 1,889 additions and 825 deletions.
1 change: 1 addition & 0 deletions CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
coffeescript.org
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2011 Jeremy Ashkenas
Copyright (c) 2009-2012 Jeremy Ashkenas

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
Expand Down
114 changes: 114 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@

____
| _ \
.- ----------- -. | |_) | ___ ___ _ __
( (.} {.} {.} } ) | _ < / _ \/ _ \ '__|
|`-..________ ..-'| | |_) | __/ __/ |
| | |____/ \___|\___|_|
| ;--.
| (__ \ _____ _ _
| | ) ) / ____| (_) | |
| |/ / | (___ ___ _ __ _ _ __ | |_
| ( / \___ \ / __| '__| | '_ \| __|
| |/ ____) | (__| | | | |_) | |_
| | |_____/ \___|_| |_| .__/ \__|
`-.._________..-' | |
|_|

* support for @_private
* support for @[$private + 'private']
* support for goog.provide via --goog switch
* include goog.dom as dom via --goog switch
* auto include base class
* support for enumeration



enumeration builder.ui.ColumnLayout.ORIENTATION
VERTICAL: 'vertical'
BLA: 'horizontal'

```coffee
include goog.dom as dom
include builder.ui.Component as bui

class builder.ui.ColumnLayout extends goog.ui.Component
constructor: ->
dom.getElementByClass 'xxx'


enumeration builder.ui.ColumnLayout.ORIENTATION
VERTICAL: 'vertical'
BLA: 'horizontal'
```

```javascript
goog.provide('builder.ui.ColumnLayout');
goog.provide('builder.ui.ColumnLayout.ORIENTATION');

goog.require('builder.ui.Component');
goog.require('goog.dom');

goog.scope(function () {
var bui = 'builder.ui.Component';
var dom = 'goog.dom';


builder.ui.ColumnLayout = (function (_super) {
var $private;

__extends(ColumnLayout, _super);

$private = '$builder_ui_ColumnLayout_';

function ColumnLayout() {
dom.getElementByClass('xxx');
}

return ColumnLayout;

})(goog.ui.Component);

builder.ui.ColumnLayout.ORIENTATION = {
VERTICAL: 'vertical',
HORIZONTAL: 'horizontal'
};

}); // close goog.scope()
```



----------------------------------------------------------------

CoffeeScript is a little language that compiles into JavaScript.

Install Node.js, and then the CoffeeScript compiler:
sudo bin/cake install

Or, if you have the Node Package Manager installed:
npm install -g coffee-script
(Leave off the -g if you don't wish to install globally.)

Execute a script:
coffee /path/to/script.coffee

Compile a script:
coffee -c /path/to/script.coffee

For documentation, usage, and examples, see:
http://coffeescript.org/

To suggest a feature, report a bug, or general discussion:
http://github.com/jashkenas/coffee-script/issues/

If you'd like to chat, drop by #coffeescript on Freenode IRC,
or on webchat.freenode.net.

The source repository:
git://github.com/jashkenas/coffee-script.git

All contributors are listed here:
http://github.com/jashkenas/coffee-script/contributors
2 changes: 1 addition & 1 deletion documentation/coffee/block_comment.coffee
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
###
CoffeeScript Compiler v1.2.0
CoffeeScript Compiler v1.3.1
Released under the MIT License
###

Expand Down
1 change: 0 additions & 1 deletion documentation/coffee/conditionals.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ else

date = if friday then sue else jill

options or= defaults


3 changes: 2 additions & 1 deletion documentation/coffee/existence.coffee
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
solipsism = true if mind? and not world?

speed ?= 75
speed = 0
speed ?= 15

footprints = yeti ? "bear"

Expand Down
8 changes: 5 additions & 3 deletions documentation/coffee/slices.coffee
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9]

copy = numbers[0...numbers.length]
start = numbers[0..2]

middle = copy[3..6]
middle = numbers[3...6]

end = numbers[6..]

copy = numbers[..]
3 changes: 2 additions & 1 deletion documentation/docs/browser.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<!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>
<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>
<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>
<span class="nx">options</span><span class="p">.</span><span class="nx">bare</span> <span class="o">?=</span> <span class="kc">on</span>
<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>
<span class="nv">options.bare = </span><span class="kc">on</span>
<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>
Expand Down
5 changes: 3 additions & 2 deletions documentation/docs/cake.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
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>
<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>
<span class="nx">process</span><span class="p">.</span><span class="nx">chdir</span> <span class="nx">cakefileDirectory</span> <span class="nx">__originalDirname</span>
<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>
<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>
<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>
<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>
<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>
Expand All @@ -34,7 +34,8 @@
<span class="k">catch</span> <span class="nx">e</span>
<span class="k">return</span> <span class="nx">fatalError</span> <span class="s2">&quot;#{e}&quot;</span>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
Expand Down
Loading

0 comments on commit f0d00f4

Please sign in to comment.