├── .DS_Store ├── .gitignore ├── History.md ├── LICENSE ├── README.md ├── bin ├── build ├── buildscripts ├── command.js ├── expect ├── kaffeine ├── knode └── knode2 ├── browser2 ├── brequire.js ├── index.html ├── index.js ├── kaffeine-browser.js ├── lib │ ├── browser.js │ ├── command.js │ ├── kaffeine.js │ ├── plugins │ │ ├── at.js │ │ ├── bang.js │ │ ├── brackets_for_keywords.js │ │ ├── default_args.js │ │ ├── extend_for.js │ │ ├── hash.js │ │ ├── implicit_brackets.js │ │ ├── implicit_functions.js │ │ ├── implicit_return.js │ │ ├── implicit_vars.js │ │ ├── multiline_strings.js │ │ ├── operators.js │ │ ├── pipe.js │ │ ├── pipe_pre.js │ │ ├── pre_pipe.js │ │ ├── prototype.js │ │ ├── string_interpolation.js │ │ └── undouble_brackets.js │ └── token.js ├── plugins.js ├── style.css └── test │ ├── arrow.k │ ├── async.k │ ├── at.k │ ├── backticks.k │ ├── backticks_pipe.k │ ├── bang.k │ ├── brackets_for_functions.k │ ├── brackets_for_keywords.k │ ├── class.k │ ├── coffee.k │ ├── comments.k │ ├── comments2.k │ ├── destructured_assignment.k │ ├── double_brackets.k │ ├── existential.k │ ├── extend_for.k │ ├── extended_arguments.k │ ├── fat_arrow.k │ ├── floats.k │ ├── full_on.k │ ├── full_stack.k │ ├── half_operators.k │ ├── implicit_brackets.k │ ├── implicit_object_keys.k │ ├── implicit_return.k │ ├── implicit_vars.k │ ├── indented_blocks.k │ ├── indented_objects.k │ ├── linenumbers.k │ ├── missing_commas.k │ ├── multi_objects.k │ ├── multiline_strings.k │ ├── old │ ├── arrow.k │ ├── at.k │ ├── backticks.k │ ├── backticks_pipe.k │ ├── brackets_for_functions.k │ ├── brackets_for_keywords.k │ ├── class.k │ ├── coffee.k │ ├── comments.k │ ├── comments2.k │ ├── destructured_assignment.k │ ├── double_brackets.k │ ├── existential.k │ ├── extend_for.k │ ├── extended_arguments.k │ ├── fat_arrow.k │ ├── floats.k │ ├── full_stack.k │ ├── half_operators.k │ ├── implicit_object_keys.k │ ├── implicit_return.k │ ├── implicit_vars.k │ ├── indented_blocks.k │ ├── indented_objects.k │ ├── linenumbers.k │ ├── missing_commas.k │ ├── multi_objects.k │ ├── operators.k │ ├── prototype.k │ ├── regexs.k │ ├── reverse_blocks.k │ ├── slices.k │ ├── super.k │ ├── unless.k │ └── using.k │ ├── operators.k │ ├── pipe.k │ ├── prototype.k │ ├── regexs.k │ ├── reverse_blocks.k │ ├── slices.k │ ├── string_interpolation.k │ ├── super.k │ ├── test │ ├── arrow.k │ ├── at.k │ ├── backticks.k │ ├── backticks_pipe.k │ ├── brackets_for_functions.k │ ├── brackets_for_keywords.k │ ├── class.k │ ├── coffee.k │ ├── comments.k │ ├── comments2.k │ ├── destructured_assignment.k │ ├── double_brackets.k │ ├── extend_for.k │ ├── extended_arguments.k │ ├── fat_arrow.k │ ├── floats.k │ ├── full_on.k │ ├── full_stack.k │ ├── half_operators.k │ ├── implicit_object_keys.k │ ├── implicit_return.k │ ├── implicit_vars.k │ ├── indented_blocks.k │ ├── indented_objects.k │ ├── missing_commas.k │ ├── multi_objects.k │ ├── multiline_strings.k │ ├── operators.k │ ├── prototype.k │ ├── regexs.k │ ├── reverse_blocks.k │ ├── slices.k │ ├── string_interpolation.k │ ├── super.k │ ├── unless.k │ └── using.k │ ├── unless.k │ └── using.k ├── expectations ├── _TODO ├── _base ├── _operators ├── _stacks ├── _tmp ├── arrow ├── at ├── bang ├── block_scope ├── brackets_for_keywords ├── class ├── default_args ├── englify ├── extend_for ├── extracting_regex_strings ├── hash ├── implicit_brackets ├── implicit_return ├── implicit_vars ├── multiline_strings ├── operators ├── parse ├── pipe ├── pipe_stack ├── pre_pipe ├── prototype ├── ruby_symbols ├── stack_functions_brackets ├── stacks ├── string_interpolation └── using ├── lib ├── browser.js ├── index.js ├── plugins │ ├── arrow.js │ ├── at.js │ ├── bang.js │ ├── block_scope.js │ ├── brackets_for_keywords.js │ ├── class.js │ ├── default_args.js │ ├── englify.js │ ├── extend_for.js │ ├── hash.js │ ├── implicit_brackets.js │ ├── implicit_return.js │ ├── implicit_vars.js │ ├── multiline_strings.js │ ├── operators.js │ ├── pipe.js │ ├── pre_pipe.js │ ├── prototype.js │ ├── ruby_symbols.js │ ├── string_interpolation.js │ ├── super.js │ ├── undouble_brackets.js │ └── using.js ├── token.js └── uglify │ ├── parse-js.js │ └── process.js ├── package.json ├── test ├── kaffeine │ ├── a.js │ └── a.k ├── old │ ├── arrow.k │ ├── at.k │ ├── bang.k │ ├── extend_for.k │ ├── full_stack.k │ ├── implicit_brackets.k │ ├── implicit_return.k │ ├── implicit_vars.k │ ├── multiline_strings.k │ ├── pipe.k │ ├── prototype.k │ └── string_interpolation.k ├── older │ ├── arrow.k │ ├── at.k │ ├── backticks.k │ ├── backticks_pipe.k │ ├── brackets_for_functions.k │ ├── brackets_for_keywords.k │ ├── class.k │ ├── coffee.k │ ├── comments.k │ ├── comments2.k │ ├── destructured_assignment.k │ ├── double_brackets.k │ ├── existential.k │ ├── extend_for.k │ ├── extended_arguments.k │ ├── fat_arrow.k │ ├── floats.k │ ├── full_stack.k │ ├── half_operators.k │ ├── implicit_object_keys.k │ ├── implicit_return.k │ ├── implicit_vars.k │ ├── indented_blocks.k │ ├── indented_objects.k │ ├── linenumbers.k │ ├── missing_commas.k │ ├── multi_objects.k │ ├── operators.k │ ├── regexs.k │ ├── reverse_blocks.k │ ├── slices.k │ ├── super.k │ ├── unless.k │ └── using.k ├── pipe.k ├── test.k ├── test_knode.k ├── test_node.js └── test_regex.js └── web ├── bin └── build ├── css ├── sausage.css └── style.css ├── fonts ├── HirukoBlackAlternate-demo.html ├── generator_config.txt ├── hirukoblackalternate-webfont.eot ├── hirukoblackalternate-webfont.svg ├── hirukoblackalternate-webfont.ttf ├── hirukoblackalternate-webfont.woff ├── specimen_files │ ├── easytabs.js │ ├── grid_12-825-55-15.css │ ├── hirukoblackalternate-cleartype.png │ └── specimen_stylesheet.css └── stylesheet.css ├── index.html ├── index.jade ├── js ├── app.js ├── highlighter.js ├── jquery.fittext.js ├── jquery.lettering-0.6.1.min.js ├── jquery.sausage.js └── jquery.widget.js ├── sections ├── arrow.jade ├── bang.jade ├── block_scope.jade ├── classes.jade ├── default_arguments.jade ├── english.jade ├── footer.jade ├── for_loop.jade ├── hash.jade ├── header.jade ├── implicit_return.jade ├── implicit_vars.jade ├── installation.jade ├── operators.jade ├── optional_brackets.jade ├── overview.jade ├── pipe.jade ├── roadmap.jade ├── started.jade ├── strings.jade ├── this.jade └── using.jade └── try ├── clearss.css ├── index.html ├── jquery.js ├── kaffeine-browser.js └── runner.js /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/weepy/kaffeine/231333e6563501235bc10b24e7efcafd2e2d9b91/.DS_Store -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /History.md: -------------------------------------------------------------------------------- 1 | 0.1.6 2 | * class followed by : is converted to 'class' 3 | * allow expressions for super classes: class X extends require("../lib").expr 4 | 5 | Version 0.1.5 6 | * removed block scope plugin 7 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010 Jonah Fox 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | _ __ __ __ _ 3 | | |/ /__ _ / _|/ _|___(_)_ _ ___ 4 | | ' </ _` | _| _/ -_) | ' \/ -_) 5 | |_|\_\__,_|_| |_| \___|_|_||_\___| 6 |7 | 8 | 9 | * Progressively enhance Javascript syntax: ensure vanilla Javascript still works as normal 10 | * avoid nice-to-haves, concentrate on small useful feature set and pragmatism 11 | * Hackable, modular, extendable and testable 12 | * whitespace is _not_ significant. Looks nice, but is painful to work with. 13 | 14 | 15 | Example 16 | ======= 17 | 18 |
19 | Edge::add = (nick, name, complete) { 20 | @client.select 15 21 | user = User.find! {id: nick} 22 | puzzle = Puzzle.find! {name: name} 23 | err, data = client.set! "u:#{user}:p:#{puzzle}" 24 | complete() 25 | } 26 |27 | 28 | READ MORE HERE ---> http://weepy.github.com/kaffeine <----- 29 | 30 | also on IRC: #altjs 31 | 32 | 33 | Tests 34 | ===== 35 | 36 | * via Node 37 | -
bin/expect
will run all tests
38 | - bin/expect file_name
will a particular test e.g. bin/expect expectations/arrow
39 | * via Browser
40 | - load browser/runner.html
41 |
42 | * Integration tests:
43 | - node test/test_node.js
44 | - knode test/test_knode.js
45 |
46 | Building tests for the browser
47 | =====
48 |
49 | bin/build
50 |
51 | depends on brequire (http://github.com/weepy/brequire).
52 |
53 | Install
54 | =======
55 |
56 | npm install kaffeine
57 |
58 | requires node >= 0.3.1
59 |
60 | Use
61 | ===
62 |
63 | Compile a script from the command line:
64 | kaffeine -c /path/to/script.k65 | 66 | See
kaffeine --help
for more
67 |
68 |
69 | Run a kaffeine file directly
70 | knode /path/to/script.k71 | 72 | require kaffeine files in scripts (in this case my_script.k): 73 |
74 | require('kaffeine') 75 | require('my_script') 76 |77 | 78 | TODO 79 | ==== 80 | 81 | * need --- operator for delimiting bangs! 82 | * nested for loops - is there a problem ? 83 | -------------------------------------------------------------------------------- /bin/build: -------------------------------------------------------------------------------- 1 | brequire lib/ browser/lib/ 2 | ./bin/buildscripts -------------------------------------------------------------------------------- /bin/buildscripts: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | require("brequire")("./lib") 4 | .module_base("kaffeine") 5 | .include_lib() 6 | // .inspect() 7 | .write("./web/try/kaffeine-browser.js") 8 | -------------------------------------------------------------------------------- /bin/kaffeine: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | var path = require('path'); 4 | var fs = require('fs'); 5 | var lib = path.join(path.dirname(fs.realpathSync(__filename)), '../lib'); 6 | 7 | require('./command').run(); 8 | -------------------------------------------------------------------------------- /bin/knode: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | require("kaffeine") 3 | var path = require("path") 4 | 5 | var x = process.ARGV.length - 1 6 | var file = process.ARGV[x] 7 | 8 | if(!file) { 9 | console.log("missing source file?") 10 | return 11 | } 12 | var abs = path.join(process.cwd(), "./", file).replace(/.k$/, "") 13 | 14 | process.chdir(path.dirname(abs)) 15 | require(abs) 16 | -------------------------------------------------------------------------------- /bin/knode2: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | var child = require('child_process').spawn("knode", process.ARGV.slice(2)) 4 | 5 | child.stdout.pipe(process.stdout, { end: false }) 6 | child.stderr.pipe(process.stderr, { end: false }) 7 | child.stdin.pipe(process.stdin, { end: false }) 8 | 9 | -------------------------------------------------------------------------------- /browser2/brequire.js: -------------------------------------------------------------------------------- 1 | // Brequire - CommonJS support for the browser 2 | function require(path) { 3 | var module = require.modules[path]; 4 | if(!module) { 5 | throw("couldn't find module for: " + path); 6 | } 7 | if(!module.exports) { 8 | module.exports = {}; 9 | module.call(module.exports, module, module.exports, require.bind(path)); 10 | } 11 | return module.exports; 12 | } 13 | 14 | require.modules = {}; 15 | 16 | require.bind = function(path) { 17 | var cwd = path.replace(/[^\/]*$/,""); 18 | return function(p) { 19 | p = (cwd + p).replace(/\/\.\//, "/").replace(/[^\/]*\/\.\./,"").replace(/\/\//,"/"); 20 | return require(p); 21 | }; 22 | }; 23 | 24 | require.module = function(path, fn) { 25 | require.modules[path] = fn; 26 | }; -------------------------------------------------------------------------------- /browser2/index.js: -------------------------------------------------------------------------------- 1 | for(var i in Plugins) { document.write(" 4 | 5 | 6 | 7 | 8 | 16 | 17 | 18 | 19 | 20 |
38 | 39 | 40 | 41 |
42 |