spade 0.0.8.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +0 -1
- data/.gitmodules +4 -4
- data/README.md +4 -0
- data/bin/spade +1 -1
- data/lib/spade.rb +0 -51
- data/lib/spade/cli.rb +10 -4
- data/lib/spade/version.rb +1 -1
- data/spade.gemspec +4 -21
- metadata +13 -482
- data/Gemfile +0 -3
- data/Gemfile.lock +0 -40
- data/lib/index.js +0 -14
- data/lib/node/loader.js +0 -146
- data/lib/node/sandbox.js +0 -44
- data/lib/spade.js +0 -1130
- data/lib/spade/bundle.rb +0 -171
- data/lib/spade/cli/base.rb +0 -354
- data/lib/spade/cli/owner.rb +0 -45
- data/lib/spade/cli/project_generator.rb +0 -58
- data/lib/spade/compiler.rb +0 -34
- data/lib/spade/console.rb +0 -39
- data/lib/spade/context.rb +0 -116
- data/lib/spade/credentials.rb +0 -36
- data/lib/spade/dependency_installer.rb +0 -103
- data/lib/spade/environment.rb +0 -35
- data/lib/spade/exports.rb +0 -71
- data/lib/spade/installer.rb +0 -40
- data/lib/spade/loader.rb +0 -238
- data/lib/spade/local.rb +0 -46
- data/lib/spade/package.rb +0 -157
- data/lib/spade/reactor.rb +0 -159
- data/lib/spade/remote.rb +0 -99
- data/lib/spade/repository.rb +0 -18
- data/lib/spade/server.rb +0 -66
- data/lib/spade/shell.rb +0 -36
- data/lib/spade/templates/project/LICENSE +0 -19
- data/lib/spade/templates/project/README.md +0 -21
- data/lib/spade/templates/project/lib/main.js +0 -9
- data/lib/spade/templates/project/project.json +0 -31
- data/lib/spade/templates/project/tests/main-test.js +0 -8
- data/package.json +0 -27
- data/packages/coffee-script/.gitignore +0 -8
- data/packages/coffee-script/.npmignore +0 -11
- data/packages/coffee-script/Cakefile +0 -229
- data/packages/coffee-script/LICENSE +0 -22
- data/packages/coffee-script/README +0 -47
- data/packages/coffee-script/Rakefile +0 -78
- data/packages/coffee-script/bin/cake +0 -7
- data/packages/coffee-script/bin/coffee +0 -7
- data/packages/coffee-script/documentation/coffee/aliases.coffee +0 -11
- data/packages/coffee-script/documentation/coffee/array_comprehensions.coffee +0 -2
- data/packages/coffee-script/documentation/coffee/block_comment.coffee +0 -6
- data/packages/coffee-script/documentation/coffee/cake_tasks.coffee +0 -9
- data/packages/coffee-script/documentation/coffee/classes.coffee +0 -25
- data/packages/coffee-script/documentation/coffee/comparisons.coffee +0 -5
- data/packages/coffee-script/documentation/coffee/conditionals.coffee +0 -13
- data/packages/coffee-script/documentation/coffee/default_args.coffee +0 -8
- data/packages/coffee-script/documentation/coffee/do.coffee +0 -4
- data/packages/coffee-script/documentation/coffee/embedded.coffee +0 -5
- data/packages/coffee-script/documentation/coffee/existence.coffee +0 -10
- data/packages/coffee-script/documentation/coffee/expressions.coffee +0 -9
- data/packages/coffee-script/documentation/coffee/expressions_assignment.coffee +0 -3
- data/packages/coffee-script/documentation/coffee/expressions_comprehension.coffee +0 -3
- data/packages/coffee-script/documentation/coffee/expressions_try.coffee +0 -7
- data/packages/coffee-script/documentation/coffee/fat_arrow.coffee +0 -6
- data/packages/coffee-script/documentation/coffee/functions.coffee +0 -2
- data/packages/coffee-script/documentation/coffee/heredocs.coffee +0 -7
- data/packages/coffee-script/documentation/coffee/heregexes.coffee +0 -11
- data/packages/coffee-script/documentation/coffee/interpolation.coffee +0 -6
- data/packages/coffee-script/documentation/coffee/multiple_return_values.coffee +0 -7
- data/packages/coffee-script/documentation/coffee/object_comprehensions.coffee +0 -4
- data/packages/coffee-script/documentation/coffee/object_extraction.coffee +0 -13
- data/packages/coffee-script/documentation/coffee/objects_and_arrays.coffee +0 -19
- data/packages/coffee-script/documentation/coffee/objects_reserved.coffee +0 -5
- data/packages/coffee-script/documentation/coffee/overview.coffee +0 -28
- data/packages/coffee-script/documentation/coffee/parallel_assignment.coffee +0 -6
- data/packages/coffee-script/documentation/coffee/patterns_and_splats.coffee +0 -7
- data/packages/coffee-script/documentation/coffee/prototypes.coffee +0 -3
- data/packages/coffee-script/documentation/coffee/range_comprehensions.coffee +0 -2
- data/packages/coffee-script/documentation/coffee/scope.coffee +0 -5
- data/packages/coffee-script/documentation/coffee/slices.coffee +0 -7
- data/packages/coffee-script/documentation/coffee/soaks.coffee +0 -1
- data/packages/coffee-script/documentation/coffee/splats.coffee +0 -27
- data/packages/coffee-script/documentation/coffee/splices.coffee +0 -5
- data/packages/coffee-script/documentation/coffee/strings.coffee +0 -8
- data/packages/coffee-script/documentation/coffee/switch.coffee +0 -10
- data/packages/coffee-script/documentation/coffee/try.coffee +0 -8
- data/packages/coffee-script/documentation/coffee/while.coffee +0 -10
- data/packages/coffee-script/documentation/css/docs.css +0 -374
- data/packages/coffee-script/documentation/css/idle.css +0 -64
- data/packages/coffee-script/documentation/docs/browser.html +0 -25
- data/packages/coffee-script/documentation/docs/cake.html +0 -43
- data/packages/coffee-script/documentation/docs/coffee-script.html +0 -51
- data/packages/coffee-script/documentation/docs/command.html +0 -161
- data/packages/coffee-script/documentation/docs/docco.css +0 -186
- data/packages/coffee-script/documentation/docs/grammar.html +0 -399
- data/packages/coffee-script/documentation/docs/helpers.html +0 -31
- data/packages/coffee-script/documentation/docs/index.html +0 -3
- data/packages/coffee-script/documentation/docs/lexer.html +0 -490
- data/packages/coffee-script/documentation/docs/nodes.html +0 -1338
- data/packages/coffee-script/documentation/docs/optparse.html +0 -78
- data/packages/coffee-script/documentation/docs/repl.html +0 -24
- data/packages/coffee-script/documentation/docs/rewriter.html +0 -251
- data/packages/coffee-script/documentation/docs/scope.html +0 -54
- data/packages/coffee-script/documentation/docs/underscore.html +0 -295
- data/packages/coffee-script/documentation/images/background.png +0 -0
- data/packages/coffee-script/documentation/images/banding.png +0 -0
- data/packages/coffee-script/documentation/images/button_bg.png +0 -0
- data/packages/coffee-script/documentation/images/button_bg_dark.gif +0 -0
- data/packages/coffee-script/documentation/images/button_bg_green.gif +0 -0
- data/packages/coffee-script/documentation/images/favicon.ico +0 -0
- data/packages/coffee-script/documentation/images/logo.png +0 -0
- data/packages/coffee-script/documentation/images/screenshadow.png +0 -0
- data/packages/coffee-script/documentation/index.html.erb +0 -1607
- data/packages/coffee-script/documentation/js/aliases.js +0 -17
- data/packages/coffee-script/documentation/js/array_comprehensions.js +0 -6
- data/packages/coffee-script/documentation/js/block_comment.js +0 -4
- data/packages/coffee-script/documentation/js/cake_tasks.js +0 -10
- data/packages/coffee-script/documentation/js/classes.js +0 -44
- data/packages/coffee-script/documentation/js/comparisons.js +0 -3
- data/packages/coffee-script/documentation/js/conditionals.js +0 -12
- data/packages/coffee-script/documentation/js/default_args.js +0 -7
- data/packages/coffee-script/documentation/js/do.js +0 -10
- data/packages/coffee-script/documentation/js/embedded.js +0 -4
- data/packages/coffee-script/documentation/js/existence.js +0 -6
- data/packages/coffee-script/documentation/js/expressions.js +0 -15
- data/packages/coffee-script/documentation/js/expressions_assignment.js +0 -2
- data/packages/coffee-script/documentation/js/expressions_comprehension.js +0 -9
- data/packages/coffee-script/documentation/js/expressions_try.js +0 -7
- data/packages/coffee-script/documentation/js/fat_arrow.js +0 -9
- data/packages/coffee-script/documentation/js/functions.js +0 -7
- data/packages/coffee-script/documentation/js/heredocs.js +0 -2
- data/packages/coffee-script/documentation/js/heregexes.js +0 -2
- data/packages/coffee-script/documentation/js/interpolation.js +0 -4
- data/packages/coffee-script/documentation/js/multiple_return_values.js +0 -5
- data/packages/coffee-script/documentation/js/object_comprehensions.js +0 -15
- data/packages/coffee-script/documentation/js/object_extraction.js +0 -10
- data/packages/coffee-script/documentation/js/objects_and_arrays.js +0 -17
- data/packages/coffee-script/documentation/js/objects_reserved.js +0 -4
- data/packages/coffee-script/documentation/js/overview.js +0 -35
- data/packages/coffee-script/documentation/js/parallel_assignment.js +0 -4
- data/packages/coffee-script/documentation/js/patterns_and_splats.js +0 -4
- data/packages/coffee-script/documentation/js/prototypes.js +0 -3
- data/packages/coffee-script/documentation/js/range_comprehensions.js +0 -9
- data/packages/coffee-script/documentation/js/scope.js +0 -8
- data/packages/coffee-script/documentation/js/slices.js +0 -4
- data/packages/coffee-script/documentation/js/soaks.js +0 -2
- data/packages/coffee-script/documentation/js/splats.js +0 -15
- data/packages/coffee-script/documentation/js/splices.js +0 -3
- data/packages/coffee-script/documentation/js/strings.js +0 -2
- data/packages/coffee-script/documentation/js/switch.js +0 -23
- data/packages/coffee-script/documentation/js/try.js +0 -8
- data/packages/coffee-script/documentation/js/while.js +0 -18
- data/packages/coffee-script/documentation/vendor/jquery-1.4.2.js +0 -6240
- data/packages/coffee-script/examples/beautiful_code/binary_search.coffee +0 -16
- data/packages/coffee-script/examples/beautiful_code/quicksort_runtime.coffee +0 -13
- data/packages/coffee-script/examples/beautiful_code/regular_expression_matcher.coffee +0 -34
- data/packages/coffee-script/examples/blocks.coffee +0 -54
- data/packages/coffee-script/examples/code.coffee +0 -167
- data/packages/coffee-script/examples/computer_science/README +0 -4
- data/packages/coffee-script/examples/computer_science/binary_search.coffee +0 -25
- data/packages/coffee-script/examples/computer_science/bubble_sort.coffee +0 -11
- data/packages/coffee-script/examples/computer_science/linked_list.coffee +0 -108
- data/packages/coffee-script/examples/computer_science/luhn_algorithm.coffee +0 -36
- data/packages/coffee-script/examples/computer_science/merge_sort.coffee +0 -19
- data/packages/coffee-script/examples/computer_science/selection_sort.coffee +0 -23
- data/packages/coffee-script/examples/poignant.coffee +0 -181
- data/packages/coffee-script/examples/potion.coffee +0 -206
- data/packages/coffee-script/examples/underscore.coffee +0 -682
- data/packages/coffee-script/examples/web_server.coffee +0 -12
- data/packages/coffee-script/extras/EXTRAS +0 -7
- data/packages/coffee-script/extras/coffee-script.js +0 -8
- data/packages/coffee-script/extras/jsl.conf +0 -44
- data/packages/coffee-script/index.html +0 -2515
- data/packages/coffee-script/lib/browser.js +0 -52
- data/packages/coffee-script/lib/cake.js +0 -76
- data/packages/coffee-script/lib/coffee-script.js +0 -82
- data/packages/coffee-script/lib/command.js +0 -263
- data/packages/coffee-script/lib/grammar.js +0 -581
- data/packages/coffee-script/lib/helpers.js +0 -66
- data/packages/coffee-script/lib/index.js +0 -8
- data/packages/coffee-script/lib/lexer.js +0 -633
- data/packages/coffee-script/lib/nodes.js +0 -2165
- data/packages/coffee-script/lib/optparse.js +0 -111
- data/packages/coffee-script/lib/parser.js +0 -649
- data/packages/coffee-script/lib/repl.js +0 -42
- data/packages/coffee-script/lib/rewriter.js +0 -353
- data/packages/coffee-script/lib/scope.js +0 -120
- data/packages/coffee-script/lib/spade-format.js +0 -45
- data/packages/coffee-script/package.json +0 -26
- data/packages/coffee-script/src/browser.coffee +0 -43
- data/packages/coffee-script/src/cake.coffee +0 -69
- data/packages/coffee-script/src/coffee-script.coffee +0 -92
- data/packages/coffee-script/src/command.coffee +0 -214
- data/packages/coffee-script/src/grammar.coffee +0 -590
- data/packages/coffee-script/src/helpers.coffee +0 -56
- data/packages/coffee-script/src/index.coffee +0 -2
- data/packages/coffee-script/src/lexer.coffee +0 -653
- data/packages/coffee-script/src/nodes.coffee +0 -1754
- data/packages/coffee-script/src/optparse.coffee +0 -99
- data/packages/coffee-script/src/repl.coffee +0 -42
- data/packages/coffee-script/src/rewriter.coffee +0 -326
- data/packages/coffee-script/src/scope.coffee +0 -94
- data/packages/coffee-script/test/arguments.coffee +0 -127
- data/packages/coffee-script/test/assignment.coffee +0 -98
- data/packages/coffee-script/test/break.coffee +0 -18
- data/packages/coffee-script/test/comments.coffee +0 -201
- data/packages/coffee-script/test/conditionals.coffee +0 -181
- data/packages/coffee-script/test/exception_handling.coffee +0 -90
- data/packages/coffee-script/test/helpers.coffee +0 -96
- data/packages/coffee-script/test/importing.coffee +0 -18
- data/packages/coffee-script/test/operators.coffee +0 -225
- data/packages/coffee-script/test/ranges_slices_and_splices.coffee +0 -186
- data/packages/coffee-script/test/regular_expressions.coffee +0 -56
- data/packages/coffee-script/test/test.html +0 -123
- data/packages/coffee-script/test/test_chaining.coffee +0 -77
- data/packages/coffee-script/test/test_classes.coffee +0 -372
- data/packages/coffee-script/test/test_compilation.coffee +0 -26
- data/packages/coffee-script/test/test_comprehensions.coffee +0 -318
- data/packages/coffee-script/test/test_existence.coffee +0 -165
- data/packages/coffee-script/test/test_functions.coffee +0 -379
- data/packages/coffee-script/test/test_heredocs.coffee +0 -111
- data/packages/coffee-script/test/test_literals.coffee +0 -270
- data/packages/coffee-script/test/test_option_parser.coffee +0 -27
- data/packages/coffee-script/test/test_pattern_matching.coffee +0 -162
- data/packages/coffee-script/test/test_returns.coffee +0 -63
- data/packages/coffee-script/test/test_splats.coffee +0 -102
- data/packages/coffee-script/test/test_strings.coffee +0 -118
- data/packages/coffee-script/test/test_switch.coffee +0 -103
- data/packages/coffee-script/test/test_while.coffee +0 -71
- data/packages/ivory/LICENSE.txt +0 -1
- data/packages/ivory/README.md +0 -19
- data/packages/ivory/lib/buffer.js +0 -111
- data/packages/ivory/lib/events.js +0 -137
- data/packages/ivory/lib/fs.js +0 -266
- data/packages/ivory/lib/main.js +0 -13
- data/packages/ivory/lib/path.js +0 -158
- data/packages/ivory/lib/ruby/buffer.rb +0 -145
- data/packages/ivory/lib/ruby/constants.rb +0 -585
- data/packages/ivory/lib/ruby/events.rb +0 -32
- data/packages/ivory/lib/ruby/fs.rb +0 -245
- data/packages/ivory/lib/ruby/process.rb +0 -28
- data/packages/ivory/lib/stream.js +0 -115
- data/packages/ivory/lib/util.js +0 -414
- data/packages/ivory/package.json +0 -11
- data/packages/jquery/main.js +0 -7179
- data/packages/jquery/package.json +0 -10
- data/packages/json/lib/main.js +0 -14
- data/packages/json/package.json +0 -8
- data/packages/lproj/README.md +0 -77
- data/packages/lproj/examples/demo-app/en.lproj/localized.strings +0 -2
- data/packages/lproj/examples/demo-app/fr.lproj/localized.strings +0 -3
- data/packages/lproj/examples/demo-app/index.html +0 -8
- data/packages/lproj/examples/demo-app/lib/main.js +0 -7
- data/packages/lproj/examples/demo-app/package.json +0 -9
- data/packages/lproj/lib/main.js +0 -78
- data/packages/lproj/lib/strings-format.js +0 -6
- data/packages/lproj/package.json +0 -9
- data/packages/optparse/README.md +0 -161
- data/packages/optparse/TODO +0 -1
- data/packages/optparse/examples/browser-test.html +0 -75
- data/packages/optparse/examples/nodejs-test.js +0 -90
- data/packages/optparse/lib/optparse.js +0 -309
- data/packages/optparse/package.json +0 -13
- data/packages/optparse/seed.yml +0 -5
- data/packages/text/lib/main.js +0 -8
- data/packages/text/package.json +0 -9
- data/packages/web-file/README.md +0 -7
- data/packages/web-file/lib/errors.js +0 -32
- data/packages/web-file/lib/file-reader.js +0 -10
- data/packages/web-file/lib/file-system.js +0 -234
- data/packages/web-file/lib/file-writer.js +0 -10
- data/packages/web-file/lib/file.js +0 -9
- data/packages/web-file/lib/main.js +0 -34
- data/packages/web-file/lib/platform.js +0 -25
- data/packages/web-file/lib/ruby/file.rb +0 -252
- data/packages/web-file/lib/ruby/file_reader.rb +0 -69
- data/packages/web-file/lib/ruby/file_system.rb +0 -134
- data/packages/web-file/lib/ruby/file_writer.rb +0 -78
- data/packages/web-file/package.json +0 -12
- data/packages/web-typed-array/README.md +0 -7
- data/packages/web-typed-array/lib/array-buffer-view.js +0 -9
- data/packages/web-typed-array/lib/array-buffer.js +0 -7
- data/packages/web-typed-array/lib/main.js +0 -33
- data/packages/web-typed-array/lib/platform.js +0 -20
- data/packages/web-typed-array/lib/ruby/array_buffer.rb +0 -31
- data/packages/web-typed-array/lib/ruby/array_buffer_view.rb +0 -130
- data/packages/web-typed-array/lib/ruby/typed_array.rb +0 -133
- data/packages/web-typed-array/lib/typed-array.js +0 -26
- data/packages/web-typed-array/package.json +0 -9
- data/spec/cli/build_spec.rb +0 -59
- data/spec/cli/install_spec.rb +0 -120
- data/spec/cli/installed_spec.rb +0 -55
- data/spec/cli/list_spec.rb +0 -75
- data/spec/cli/login_spec.rb +0 -76
- data/spec/cli/new_spec.rb +0 -5
- data/spec/cli/owner_spec.rb +0 -115
- data/spec/cli/push_spec.rb +0 -74
- data/spec/cli/uninstall_spec.rb +0 -58
- data/spec/cli/unpack_spec.rb +0 -73
- data/spec/cli/unyank_spec.rb +0 -74
- data/spec/cli/update_spec.rb +0 -8
- data/spec/cli/yank_spec.rb +0 -74
- data/spec/credentials_spec.rb +0 -24
- data/spec/fixtures/coffee-1.0.1.pre.spd +0 -0
- data/spec/fixtures/core-test-0.4.3.spd +0 -0
- data/spec/fixtures/core-test/bin/cot +0 -3
- data/spec/fixtures/core-test/lib/main.js +0 -1
- data/spec/fixtures/core-test/resources/runner.css +0 -0
- data/spec/fixtures/core-test/tests/test.js +0 -1
- data/spec/fixtures/ivory-0.0.1.spd +0 -0
- data/spec/fixtures/jquery-1.4.3.spd +0 -0
- data/spec/fixtures/optparse-1.0.1.spd +0 -0
- data/spec/fixtures/package.json +0 -30
- data/spec/gauntlet_spec.rb +0 -27
- data/spec/javascript/async-test.js +0 -123
- data/spec/javascript/compiler/javascript.js +0 -13
- data/spec/javascript/compiler/ruby.js +0 -14
- data/spec/javascript/loader-test.js +0 -64
- data/spec/javascript/normalize-test.js +0 -73
- data/spec/javascript/packages-test.js +0 -44
- data/spec/javascript/relative-require-test.js +0 -72
- data/spec/javascript/require-test.js +0 -117
- data/spec/javascript/sandbox/compile.js +0 -37
- data/spec/javascript/sandbox/creation.js +0 -44
- data/spec/javascript/sandbox/format.js +0 -79
- data/spec/javascript/sandbox/misc.js +0 -57
- data/spec/javascript/sandbox/preprocessor.js +0 -81
- data/spec/javascript/sandbox/require.js +0 -48
- data/spec/javascript/sandbox/run-command.js +0 -21
- data/spec/javascript/spade/externs.js +0 -14
- data/spec/javascript/spade/load-factory.js +0 -15
- data/spec/javascript/spade/misc.js +0 -23
- data/spec/javascript/spade/ready.js +0 -12
- data/spec/javascript/spade/register.js +0 -13
- data/spec/javascript_spec.rb +0 -7
- data/spec/package_spec.rb +0 -267
- data/spec/spec_helper.rb +0 -30
- data/spec/support/cli.rb +0 -94
- data/spec/support/core_test.rb +0 -59
- data/spec/support/fake.rb +0 -44
- data/spec/support/fake_gem_server.rb +0 -66
- data/spec/support/fake_gemcutter.rb +0 -49
- data/spec/support/matchers.rb +0 -31
- data/spec/support/path.rb +0 -54
- data/test-spade.html +0 -8
@@ -1,581 +0,0 @@
|
|
1
|
-
(function() {
|
2
|
-
var Parser, alt, alternatives, grammar, name, o, operators, token, tokens, unwrap;
|
3
|
-
Parser = require('jison').Parser;
|
4
|
-
unwrap = /^function\s*\(\)\s*\{\s*return\s*([\s\S]*);\s*\}/;
|
5
|
-
o = function(patternString, action, options) {
|
6
|
-
var match;
|
7
|
-
patternString = patternString.replace(/\s{2,}/g, ' ');
|
8
|
-
if (!action) {
|
9
|
-
return [patternString, '$$ = $1;', options];
|
10
|
-
}
|
11
|
-
action = (match = unwrap.exec(action)) ? match[1] : "(" + action + "())";
|
12
|
-
action = action.replace(/\bnew /g, '$&yy.');
|
13
|
-
action = action.replace(/\b(?:Expressions\.wrap|extend)\b/g, 'yy.$&');
|
14
|
-
return [patternString, "$$ = " + action + ";", options];
|
15
|
-
};
|
16
|
-
grammar = {
|
17
|
-
Root: [
|
18
|
-
o('', function() {
|
19
|
-
return new Expressions;
|
20
|
-
}), o('Body'), o('Block TERMINATOR')
|
21
|
-
],
|
22
|
-
Body: [
|
23
|
-
o('Line', function() {
|
24
|
-
return Expressions.wrap([$1]);
|
25
|
-
}), o('Body TERMINATOR Line', function() {
|
26
|
-
return $1.push($3);
|
27
|
-
}), o('Body TERMINATOR')
|
28
|
-
],
|
29
|
-
Line: [o('Expression'), o('Statement')],
|
30
|
-
Statement: [
|
31
|
-
o('Return'), o('Throw'), o('Comment'), o('STATEMENT', function() {
|
32
|
-
return new Literal($1);
|
33
|
-
})
|
34
|
-
],
|
35
|
-
Expression: [o('Value'), o('Invocation'), o('Code'), o('Operation'), o('Assign'), o('If'), o('Try'), o('While'), o('For'), o('Switch'), o('Class')],
|
36
|
-
Block: [
|
37
|
-
o('INDENT OUTDENT', function() {
|
38
|
-
return new Expressions;
|
39
|
-
}), o('INDENT Body OUTDENT', function() {
|
40
|
-
return $2;
|
41
|
-
})
|
42
|
-
],
|
43
|
-
Identifier: [
|
44
|
-
o('IDENTIFIER', function() {
|
45
|
-
return new Literal($1);
|
46
|
-
})
|
47
|
-
],
|
48
|
-
AlphaNumeric: [
|
49
|
-
o('NUMBER', function() {
|
50
|
-
return new Literal($1);
|
51
|
-
}), o('STRING', function() {
|
52
|
-
return new Literal($1);
|
53
|
-
})
|
54
|
-
],
|
55
|
-
Literal: [
|
56
|
-
o('AlphaNumeric'), o('JS', function() {
|
57
|
-
return new Literal($1);
|
58
|
-
}), o('REGEX', function() {
|
59
|
-
return new Literal($1);
|
60
|
-
}), o('BOOL', function() {
|
61
|
-
return new Literal($1 === 'undefined' ? 'void 0' : $1);
|
62
|
-
})
|
63
|
-
],
|
64
|
-
Assign: [
|
65
|
-
o('Assignable = Expression', function() {
|
66
|
-
return new Assign($1, $3);
|
67
|
-
}), o('Assignable = INDENT Expression OUTDENT', function() {
|
68
|
-
return new Assign($1, $4);
|
69
|
-
})
|
70
|
-
],
|
71
|
-
AssignObj: [
|
72
|
-
o('ObjAssignable', function() {
|
73
|
-
return new Value($1);
|
74
|
-
}), o('ObjAssignable : Expression', function() {
|
75
|
-
return new Assign(new Value($1), $3, 'object');
|
76
|
-
}), o('ObjAssignable :\
|
77
|
-
INDENT Expression OUTDENT', function() {
|
78
|
-
return new Assign(new Value($1), $4, 'object');
|
79
|
-
}), o('Comment')
|
80
|
-
],
|
81
|
-
ObjAssignable: [o('Identifier'), o('AlphaNumeric'), o('ThisProperty')],
|
82
|
-
Return: [
|
83
|
-
o('RETURN Expression', function() {
|
84
|
-
return new Return($2);
|
85
|
-
}), o('RETURN', function() {
|
86
|
-
return new Return;
|
87
|
-
})
|
88
|
-
],
|
89
|
-
Comment: [
|
90
|
-
o('HERECOMMENT', function() {
|
91
|
-
return new Comment($1);
|
92
|
-
})
|
93
|
-
],
|
94
|
-
Code: [
|
95
|
-
o('PARAM_START ParamList PARAM_END FuncGlyph Block', function() {
|
96
|
-
return new Code($2, $5, $4);
|
97
|
-
}), o('FuncGlyph Block', function() {
|
98
|
-
return new Code([], $2, $1);
|
99
|
-
})
|
100
|
-
],
|
101
|
-
FuncGlyph: [
|
102
|
-
o('->', function() {
|
103
|
-
return 'func';
|
104
|
-
}), o('=>', function() {
|
105
|
-
return 'boundfunc';
|
106
|
-
})
|
107
|
-
],
|
108
|
-
OptComma: [o(''), o(',')],
|
109
|
-
ParamList: [
|
110
|
-
o('', function() {
|
111
|
-
return [];
|
112
|
-
}), o('Param', function() {
|
113
|
-
return [$1];
|
114
|
-
}), o('ParamList , Param', function() {
|
115
|
-
return $1.concat($3);
|
116
|
-
})
|
117
|
-
],
|
118
|
-
Param: [
|
119
|
-
o('ParamVar', function() {
|
120
|
-
return new Param($1);
|
121
|
-
}), o('ParamVar ...', function() {
|
122
|
-
return new Param($1, null, true);
|
123
|
-
}), o('ParamVar = Expression', function() {
|
124
|
-
return new Param($1, $3);
|
125
|
-
})
|
126
|
-
],
|
127
|
-
ParamVar: [o('Identifier'), o('ThisProperty'), o('Array'), o('Object')],
|
128
|
-
Splat: [
|
129
|
-
o('Expression ...', function() {
|
130
|
-
return new Splat($1);
|
131
|
-
})
|
132
|
-
],
|
133
|
-
SimpleAssignable: [
|
134
|
-
o('Identifier', function() {
|
135
|
-
return new Value($1);
|
136
|
-
}), o('Value Accessor', function() {
|
137
|
-
return $1.push($2);
|
138
|
-
}), o('Invocation Accessor', function() {
|
139
|
-
return new Value($1, [$2]);
|
140
|
-
}), o('ThisProperty')
|
141
|
-
],
|
142
|
-
Assignable: [
|
143
|
-
o('SimpleAssignable'), o('Array', function() {
|
144
|
-
return new Value($1);
|
145
|
-
}), o('Object', function() {
|
146
|
-
return new Value($1);
|
147
|
-
})
|
148
|
-
],
|
149
|
-
Value: [
|
150
|
-
o('Assignable'), o('Literal', function() {
|
151
|
-
return new Value($1);
|
152
|
-
}), o('Parenthetical', function() {
|
153
|
-
return new Value($1);
|
154
|
-
}), o('Range', function() {
|
155
|
-
return new Value($1);
|
156
|
-
}), o('This')
|
157
|
-
],
|
158
|
-
Accessor: [
|
159
|
-
o('. Identifier', function() {
|
160
|
-
return new Access($2);
|
161
|
-
}), o('?. Identifier', function() {
|
162
|
-
return new Access($2, 'soak');
|
163
|
-
}), o(':: Identifier', function() {
|
164
|
-
return new Access($2, 'proto');
|
165
|
-
}), o('::', function() {
|
166
|
-
return new Access(new Literal('prototype'));
|
167
|
-
}), o('Index'), o('Slice', function() {
|
168
|
-
return new Slice($1);
|
169
|
-
})
|
170
|
-
],
|
171
|
-
Index: [
|
172
|
-
o('INDEX_START Expression INDEX_END', function() {
|
173
|
-
return new Index($2);
|
174
|
-
}), o('INDEX_SOAK Index', function() {
|
175
|
-
return extend($2, {
|
176
|
-
soak: true
|
177
|
-
});
|
178
|
-
}), o('INDEX_PROTO Index', function() {
|
179
|
-
return extend($2, {
|
180
|
-
proto: true
|
181
|
-
});
|
182
|
-
})
|
183
|
-
],
|
184
|
-
Object: [
|
185
|
-
o('{ AssignList OptComma }', function() {
|
186
|
-
return new Obj($2, $1.generated);
|
187
|
-
})
|
188
|
-
],
|
189
|
-
AssignList: [
|
190
|
-
o('', function() {
|
191
|
-
return [];
|
192
|
-
}), o('AssignObj', function() {
|
193
|
-
return [$1];
|
194
|
-
}), o('AssignList , AssignObj', function() {
|
195
|
-
return $1.concat($3);
|
196
|
-
}), o('AssignList OptComma TERMINATOR AssignObj', function() {
|
197
|
-
return $1.concat($4);
|
198
|
-
}), o('AssignList OptComma INDENT AssignList OptComma OUTDENT', function() {
|
199
|
-
return $1.concat($4);
|
200
|
-
})
|
201
|
-
],
|
202
|
-
Class: [
|
203
|
-
o('CLASS', function() {
|
204
|
-
return new Class;
|
205
|
-
}), o('CLASS Block', function() {
|
206
|
-
return new Class(null, null, $2);
|
207
|
-
}), o('CLASS EXTENDS Value', function() {
|
208
|
-
return new Class(null, $3);
|
209
|
-
}), o('CLASS EXTENDS Value Block', function() {
|
210
|
-
return new Class(null, $3, $4);
|
211
|
-
}), o('CLASS SimpleAssignable', function() {
|
212
|
-
return new Class($2);
|
213
|
-
}), o('CLASS SimpleAssignable Block', function() {
|
214
|
-
return new Class($2, null, $3);
|
215
|
-
}), o('CLASS SimpleAssignable EXTENDS Value', function() {
|
216
|
-
return new Class($2, $4);
|
217
|
-
}), o('CLASS SimpleAssignable EXTENDS Value Block', function() {
|
218
|
-
return new Class($2, $4, $5);
|
219
|
-
})
|
220
|
-
],
|
221
|
-
Invocation: [
|
222
|
-
o('Value OptFuncExist Arguments', function() {
|
223
|
-
return new Call($1, $3, $2);
|
224
|
-
}), o('Invocation OptFuncExist Arguments', function() {
|
225
|
-
return new Call($1, $3, $2);
|
226
|
-
}), o('SUPER', function() {
|
227
|
-
return new Call('super', [new Splat(new Literal('arguments'))]);
|
228
|
-
}), o('SUPER Arguments', function() {
|
229
|
-
return new Call('super', $2);
|
230
|
-
})
|
231
|
-
],
|
232
|
-
OptFuncExist: [
|
233
|
-
o('', function() {
|
234
|
-
return false;
|
235
|
-
}), o('FUNC_EXIST', function() {
|
236
|
-
return true;
|
237
|
-
})
|
238
|
-
],
|
239
|
-
Arguments: [
|
240
|
-
o('CALL_START CALL_END', function() {
|
241
|
-
return [];
|
242
|
-
}), o('CALL_START ArgList OptComma CALL_END', function() {
|
243
|
-
return $2;
|
244
|
-
})
|
245
|
-
],
|
246
|
-
This: [
|
247
|
-
o('THIS', function() {
|
248
|
-
return new Value(new Literal('this'));
|
249
|
-
}), o('@', function() {
|
250
|
-
return new Value(new Literal('this'));
|
251
|
-
})
|
252
|
-
],
|
253
|
-
ThisProperty: [
|
254
|
-
o('@ Identifier', function() {
|
255
|
-
return new Value(new Literal('this'), [new Access($2)], 'this');
|
256
|
-
})
|
257
|
-
],
|
258
|
-
Array: [
|
259
|
-
o('[ ]', function() {
|
260
|
-
return new Arr([]);
|
261
|
-
}), o('[ ArgList OptComma ]', function() {
|
262
|
-
return new Arr($2);
|
263
|
-
})
|
264
|
-
],
|
265
|
-
RangeDots: [
|
266
|
-
o('..', function() {
|
267
|
-
return 'inclusive';
|
268
|
-
}), o('...', function() {
|
269
|
-
return 'exclusive';
|
270
|
-
})
|
271
|
-
],
|
272
|
-
Range: [
|
273
|
-
o('[ Expression RangeDots Expression ]', function() {
|
274
|
-
return new Range($2, $4, $3);
|
275
|
-
})
|
276
|
-
],
|
277
|
-
Slice: [
|
278
|
-
o('INDEX_START Expression RangeDots Expression INDEX_END', function() {
|
279
|
-
return new Range($2, $4, $3);
|
280
|
-
}), o('INDEX_START Expression RangeDots INDEX_END', function() {
|
281
|
-
return new Range($2, null, $3);
|
282
|
-
}), o('INDEX_START RangeDots Expression INDEX_END', function() {
|
283
|
-
return new Range(null, $3, $2);
|
284
|
-
})
|
285
|
-
],
|
286
|
-
ArgList: [
|
287
|
-
o('Arg', function() {
|
288
|
-
return [$1];
|
289
|
-
}), o('ArgList , Arg', function() {
|
290
|
-
return $1.concat($3);
|
291
|
-
}), o('ArgList OptComma TERMINATOR Arg', function() {
|
292
|
-
return $1.concat($4);
|
293
|
-
}), o('INDENT ArgList OptComma OUTDENT', function() {
|
294
|
-
return $2;
|
295
|
-
}), o('ArgList OptComma INDENT ArgList OptComma OUTDENT', function() {
|
296
|
-
return $1.concat($4);
|
297
|
-
})
|
298
|
-
],
|
299
|
-
Arg: [o('Expression'), o('Splat')],
|
300
|
-
SimpleArgs: [
|
301
|
-
o('Expression'), o('SimpleArgs , Expression', function() {
|
302
|
-
return [].concat($1, $3);
|
303
|
-
})
|
304
|
-
],
|
305
|
-
Try: [
|
306
|
-
o('TRY Block', function() {
|
307
|
-
return new Try($2);
|
308
|
-
}), o('TRY Block Catch', function() {
|
309
|
-
return new Try($2, $3[0], $3[1]);
|
310
|
-
}), o('TRY Block FINALLY Block', function() {
|
311
|
-
return new Try($2, null, null, $4);
|
312
|
-
}), o('TRY Block Catch FINALLY Block', function() {
|
313
|
-
return new Try($2, $3[0], $3[1], $5);
|
314
|
-
})
|
315
|
-
],
|
316
|
-
Catch: [
|
317
|
-
o('CATCH Identifier Block', function() {
|
318
|
-
return [$2, $3];
|
319
|
-
})
|
320
|
-
],
|
321
|
-
Throw: [
|
322
|
-
o('THROW Expression', function() {
|
323
|
-
return new Throw($2);
|
324
|
-
})
|
325
|
-
],
|
326
|
-
Parenthetical: [
|
327
|
-
o('( Body )', function() {
|
328
|
-
return new Parens($2);
|
329
|
-
}), o('( INDENT Body OUTDENT )', function() {
|
330
|
-
return new Parens($3);
|
331
|
-
})
|
332
|
-
],
|
333
|
-
WhileSource: [
|
334
|
-
o('WHILE Expression', function() {
|
335
|
-
return new While($2);
|
336
|
-
}), o('WHILE Expression WHEN Expression', function() {
|
337
|
-
return new While($2, {
|
338
|
-
guard: $4
|
339
|
-
});
|
340
|
-
}), o('UNTIL Expression', function() {
|
341
|
-
return new While($2, {
|
342
|
-
invert: true
|
343
|
-
});
|
344
|
-
}), o('UNTIL Expression WHEN Expression', function() {
|
345
|
-
return new While($2, {
|
346
|
-
invert: true,
|
347
|
-
guard: $4
|
348
|
-
});
|
349
|
-
})
|
350
|
-
],
|
351
|
-
While: [
|
352
|
-
o('WhileSource Block', function() {
|
353
|
-
return $1.addBody($2);
|
354
|
-
}), o('Statement WhileSource', function() {
|
355
|
-
return $2.addBody(Expressions.wrap([$1]));
|
356
|
-
}), o('Expression WhileSource', function() {
|
357
|
-
return $2.addBody(Expressions.wrap([$1]));
|
358
|
-
}), o('Loop', function() {
|
359
|
-
return $1;
|
360
|
-
})
|
361
|
-
],
|
362
|
-
Loop: [
|
363
|
-
o('LOOP Block', function() {
|
364
|
-
return new While(new Literal('true')).addBody($2);
|
365
|
-
}), o('LOOP Expression', function() {
|
366
|
-
return new While(new Literal('true')).addBody(Expressions.wrap([$2]));
|
367
|
-
})
|
368
|
-
],
|
369
|
-
For: [
|
370
|
-
o('Statement ForBody', function() {
|
371
|
-
return new For($1, $2);
|
372
|
-
}), o('Expression ForBody', function() {
|
373
|
-
return new For($1, $2);
|
374
|
-
}), o('ForBody Block', function() {
|
375
|
-
return new For($2, $1);
|
376
|
-
})
|
377
|
-
],
|
378
|
-
ForBody: [
|
379
|
-
o('FOR Range', function() {
|
380
|
-
return {
|
381
|
-
source: new Value($2)
|
382
|
-
};
|
383
|
-
}), o('ForStart ForSource', function() {
|
384
|
-
$2.own = $1.own;
|
385
|
-
$2.name = $1[0];
|
386
|
-
$2.index = $1[1];
|
387
|
-
return $2;
|
388
|
-
})
|
389
|
-
],
|
390
|
-
ForStart: [
|
391
|
-
o('FOR ForVariables', function() {
|
392
|
-
return $2;
|
393
|
-
}), o('FOR OWN ForVariables', function() {
|
394
|
-
$3.own = true;
|
395
|
-
return $3;
|
396
|
-
})
|
397
|
-
],
|
398
|
-
ForValue: [
|
399
|
-
o('Identifier'), o('Array', function() {
|
400
|
-
return new Value($1);
|
401
|
-
}), o('Object', function() {
|
402
|
-
return new Value($1);
|
403
|
-
})
|
404
|
-
],
|
405
|
-
ForVariables: [
|
406
|
-
o('ForValue', function() {
|
407
|
-
return [$1];
|
408
|
-
}), o('ForValue , ForValue', function() {
|
409
|
-
return [$1, $3];
|
410
|
-
})
|
411
|
-
],
|
412
|
-
ForSource: [
|
413
|
-
o('FORIN Expression', function() {
|
414
|
-
return {
|
415
|
-
source: $2
|
416
|
-
};
|
417
|
-
}), o('FOROF Expression', function() {
|
418
|
-
return {
|
419
|
-
source: $2,
|
420
|
-
object: true
|
421
|
-
};
|
422
|
-
}), o('FORIN Expression WHEN Expression', function() {
|
423
|
-
return {
|
424
|
-
source: $2,
|
425
|
-
guard: $4
|
426
|
-
};
|
427
|
-
}), o('FOROF Expression WHEN Expression', function() {
|
428
|
-
return {
|
429
|
-
source: $2,
|
430
|
-
guard: $4,
|
431
|
-
object: true
|
432
|
-
};
|
433
|
-
}), o('FORIN Expression BY Expression', function() {
|
434
|
-
return {
|
435
|
-
source: $2,
|
436
|
-
step: $4
|
437
|
-
};
|
438
|
-
}), o('FORIN Expression WHEN Expression BY Expression', function() {
|
439
|
-
return {
|
440
|
-
source: $2,
|
441
|
-
guard: $4,
|
442
|
-
step: $6
|
443
|
-
};
|
444
|
-
}), o('FORIN Expression BY Expression WHEN Expression', function() {
|
445
|
-
return {
|
446
|
-
source: $2,
|
447
|
-
step: $4,
|
448
|
-
guard: $6
|
449
|
-
};
|
450
|
-
})
|
451
|
-
],
|
452
|
-
Switch: [
|
453
|
-
o('SWITCH Expression INDENT Whens OUTDENT', function() {
|
454
|
-
return new Switch($2, $4);
|
455
|
-
}), o('SWITCH Expression INDENT Whens ELSE Block OUTDENT', function() {
|
456
|
-
return new Switch($2, $4, $6);
|
457
|
-
}), o('SWITCH INDENT Whens OUTDENT', function() {
|
458
|
-
return new Switch(null, $3);
|
459
|
-
}), o('SWITCH INDENT Whens ELSE Block OUTDENT', function() {
|
460
|
-
return new Switch(null, $3, $5);
|
461
|
-
})
|
462
|
-
],
|
463
|
-
Whens: [
|
464
|
-
o('When'), o('Whens When', function() {
|
465
|
-
return $1.concat($2);
|
466
|
-
})
|
467
|
-
],
|
468
|
-
When: [
|
469
|
-
o('LEADING_WHEN SimpleArgs Block', function() {
|
470
|
-
return [[$2, $3]];
|
471
|
-
}), o('LEADING_WHEN SimpleArgs Block TERMINATOR', function() {
|
472
|
-
return [[$2, $3]];
|
473
|
-
})
|
474
|
-
],
|
475
|
-
IfBlock: [
|
476
|
-
o('IF Expression Block', function() {
|
477
|
-
return new If($2, $3, {
|
478
|
-
type: $1
|
479
|
-
});
|
480
|
-
}), o('IfBlock ELSE IF Expression Block', function() {
|
481
|
-
return $1.addElse(new If($4, $5, {
|
482
|
-
type: $3
|
483
|
-
}));
|
484
|
-
}), o('IfBlock ELSE Block', function() {
|
485
|
-
return $1.addElse($3);
|
486
|
-
})
|
487
|
-
],
|
488
|
-
If: [
|
489
|
-
o('IfBlock'), o('Statement POST_IF Expression', function() {
|
490
|
-
return new If($3, Expressions.wrap([$1]), {
|
491
|
-
type: $2,
|
492
|
-
statement: true
|
493
|
-
});
|
494
|
-
}), o('Expression POST_IF Expression', function() {
|
495
|
-
return new If($3, Expressions.wrap([$1]), {
|
496
|
-
type: $2,
|
497
|
-
statement: true
|
498
|
-
});
|
499
|
-
})
|
500
|
-
],
|
501
|
-
Operation: [
|
502
|
-
o('UNARY Expression', function() {
|
503
|
-
return new Op($1, $2);
|
504
|
-
}), o('- Expression', (function() {
|
505
|
-
return new Op('-', $2);
|
506
|
-
}), {
|
507
|
-
prec: 'UNARY'
|
508
|
-
}), o('+ Expression', (function() {
|
509
|
-
return new Op('+', $2);
|
510
|
-
}), {
|
511
|
-
prec: 'UNARY'
|
512
|
-
}), o('-- SimpleAssignable', function() {
|
513
|
-
return new Op('--', $2);
|
514
|
-
}), o('++ SimpleAssignable', function() {
|
515
|
-
return new Op('++', $2);
|
516
|
-
}), o('SimpleAssignable --', function() {
|
517
|
-
return new Op('--', $1, null, true);
|
518
|
-
}), o('SimpleAssignable ++', function() {
|
519
|
-
return new Op('++', $1, null, true);
|
520
|
-
}), o('Expression ?', function() {
|
521
|
-
return new Existence($1);
|
522
|
-
}), o('Expression + Expression', function() {
|
523
|
-
return new Op('+', $1, $3);
|
524
|
-
}), o('Expression - Expression', function() {
|
525
|
-
return new Op('-', $1, $3);
|
526
|
-
}), o('Expression MATH Expression', function() {
|
527
|
-
return new Op($2, $1, $3);
|
528
|
-
}), o('Expression SHIFT Expression', function() {
|
529
|
-
return new Op($2, $1, $3);
|
530
|
-
}), o('Expression COMPARE Expression', function() {
|
531
|
-
return new Op($2, $1, $3);
|
532
|
-
}), o('Expression LOGIC Expression', function() {
|
533
|
-
return new Op($2, $1, $3);
|
534
|
-
}), o('Expression RELATION Expression', function() {
|
535
|
-
if ($2.charAt(0) === '!') {
|
536
|
-
return new Op($2.slice(1), $1, $3).invert();
|
537
|
-
} else {
|
538
|
-
return new Op($2, $1, $3);
|
539
|
-
}
|
540
|
-
}), o('SimpleAssignable COMPOUND_ASSIGN\
|
541
|
-
Expression', function() {
|
542
|
-
return new Assign($1, $3, $2);
|
543
|
-
}), o('SimpleAssignable COMPOUND_ASSIGN\
|
544
|
-
INDENT Expression OUTDENT', function() {
|
545
|
-
return new Assign($1, $4, $2);
|
546
|
-
}), o('SimpleAssignable EXTENDS Expression', function() {
|
547
|
-
return new Extends($1, $3);
|
548
|
-
})
|
549
|
-
]
|
550
|
-
};
|
551
|
-
operators = [['left', '.', '?.', '::'], ['left', 'CALL_START', 'CALL_END'], ['nonassoc', '++', '--'], ['left', '?'], ['right', 'UNARY'], ['left', 'MATH'], ['left', '+', '-'], ['left', 'SHIFT'], ['left', 'RELATION'], ['left', 'COMPARE'], ['left', 'LOGIC'], ['nonassoc', 'INDENT', 'OUTDENT'], ['right', '=', ':', 'COMPOUND_ASSIGN', 'RETURN', 'THROW', 'EXTENDS'], ['right', 'FORIN', 'FOROF', 'BY', 'WHEN'], ['right', 'IF', 'ELSE', 'FOR', 'DO', 'WHILE', 'UNTIL', 'LOOP', 'SUPER', 'CLASS'], ['right', 'POST_IF']];
|
552
|
-
tokens = [];
|
553
|
-
for (name in grammar) {
|
554
|
-
alternatives = grammar[name];
|
555
|
-
grammar[name] = (function() {
|
556
|
-
var _i, _j, _len, _len2, _ref, _results;
|
557
|
-
_results = [];
|
558
|
-
for (_i = 0, _len = alternatives.length; _i < _len; _i++) {
|
559
|
-
alt = alternatives[_i];
|
560
|
-
_ref = alt[0].split(' ');
|
561
|
-
for (_j = 0, _len2 = _ref.length; _j < _len2; _j++) {
|
562
|
-
token = _ref[_j];
|
563
|
-
if (!grammar[token]) {
|
564
|
-
tokens.push(token);
|
565
|
-
}
|
566
|
-
}
|
567
|
-
if (name === 'Root') {
|
568
|
-
alt[1] = "return " + alt[1];
|
569
|
-
}
|
570
|
-
_results.push(alt);
|
571
|
-
}
|
572
|
-
return _results;
|
573
|
-
})();
|
574
|
-
}
|
575
|
-
exports.parser = new Parser({
|
576
|
-
tokens: tokens.join(' '),
|
577
|
-
bnf: grammar,
|
578
|
-
operators: operators.reverse(),
|
579
|
-
startSymbol: 'Root'
|
580
|
-
});
|
581
|
-
}).call(this);
|