nilac 0.0.4.3.3 → 0.0.4.3.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +17 -17
  3. data/Gemfile +4 -4
  4. data/LICENSE +20 -20
  5. data/README.md +67 -67
  6. data/Rakefile +2 -2
  7. data/bin/nilac +4734 -4734
  8. data/lib/nilac.rb +5 -5
  9. data/lib/nilac/version.rb +3 -3
  10. data/nilac.gemspec +19 -19
  11. data/shark/features/add_auto_return_statement.feature +17 -17
  12. data/shark/features/array_and_string_indexing.feature +10 -10
  13. data/shark/features/barebones_compilation.feature +10 -10
  14. data/shark/features/default_method_parameters.feature +11 -11
  15. data/shark/features/fix_newlines.feature +12 -12
  16. data/shark/features/hashes.feature +10 -10
  17. data/shark/features/heredoc.feature +10 -10
  18. data/shark/features/if_then_else.feature +10 -10
  19. data/shark/features/loop.feature +10 -10
  20. data/shark/features/method_multiple_return.feature +16 -16
  21. data/shark/features/multiline_array.feature +10 -10
  22. data/shark/features/multiple_variable_initialization.feature +11 -11
  23. data/shark/features/numbers.feature +10 -10
  24. data/shark/features/regular_for.feature +10 -10
  25. data/shark/features/regular_if.feature +10 -10
  26. data/shark/features/regular_while.feature +10 -10
  27. data/shark/features/ruby_operators.feature +10 -10
  28. data/shark/features/string_interpolation.feature +10 -10
  29. data/shark/features/strings.feature +10 -10
  30. data/shark/features/times.feature +10 -10
  31. data/shark/features/unless_until.feature +10 -10
  32. data/shark/features/whitespace_delimitation.feature +10 -10
  33. data/shark/test_files/array_string_indexing.nila +21 -21
  34. data/shark/test_files/correct.js +4 -4
  35. data/shark/test_files/correct_default_parameters.js +22 -22
  36. data/shark/test_files/correct_for.js +26 -26
  37. data/shark/test_files/correct_hashes.js +32 -32
  38. data/shark/test_files/correct_heredoc.js +10 -10
  39. data/shark/test_files/correct_if_then_else.js +6 -6
  40. data/shark/test_files/correct_indexing.js +26 -26
  41. data/shark/test_files/correct_initialization.js +34 -34
  42. data/shark/test_files/correct_loop.js +14 -14
  43. data/shark/test_files/correct_multiline_array.js +12 -12
  44. data/shark/test_files/correct_multiple_return.js +20 -20
  45. data/shark/test_files/correct_numbers.js +8 -8
  46. data/shark/test_files/correct_operators.js +16 -16
  47. data/shark/test_files/correct_regular_if.js +13 -13
  48. data/shark/test_files/correct_regular_while.js +13 -13
  49. data/shark/test_files/correct_return.js +10 -10
  50. data/shark/test_files/correct_single_return.js +10 -10
  51. data/shark/test_files/correct_string_interpolation.js +16 -16
  52. data/shark/test_files/correct_string_operators.js +24 -24
  53. data/shark/test_files/correct_times.js +23 -23
  54. data/shark/test_files/correct_unless_until.js +28 -28
  55. data/shark/test_files/correct_whitespace_delimiter.js +16 -16
  56. data/shark/test_files/default_parameters.nila +12 -12
  57. data/shark/test_files/erratic.nila +22 -22
  58. data/shark/test_files/hashes.nila +22 -22
  59. data/shark/test_files/heredoc.nila +13 -13
  60. data/shark/test_files/loop.nila +5 -5
  61. data/shark/test_files/multiline_array.nila +12 -12
  62. data/shark/test_files/multiple_initialization.nila +16 -16
  63. data/shark/test_files/multiple_return.nila +16 -16
  64. data/shark/test_files/no_return.nila +6 -6
  65. data/shark/test_files/numbers.nila +2 -2
  66. data/shark/test_files/operators.nila +8 -8
  67. data/shark/test_files/perfect.js +16 -16
  68. data/shark/test_files/regular_for.nila +16 -16
  69. data/shark/test_files/regular_if.nila +19 -19
  70. data/shark/test_files/regular_while.nila +6 -6
  71. data/shark/test_files/ruby_methods.nila +24 -0
  72. data/shark/test_files/single_return.nila +6 -6
  73. data/shark/test_files/string_interpolation.nila +10 -10
  74. data/shark/test_files/string_operators.nila +19 -19
  75. data/shark/test_files/times.nila +12 -12
  76. data/shark/test_files/unless_until.nila +16 -16
  77. data/shark/test_files/whitespace_delimiter.nila +16 -16
  78. data/src/nilac.rb +4766 -4732
  79. metadata +4 -4
@@ -1,11 +1,11 @@
1
- Feature: This feature bring Ruby style operators to Nila
2
- Scenario: Input file with different operators
3
- Given the input file "operators.nila"
4
- When the ~compiler is run
5
- The output file must be "operators.js"
6
- The output file must equal "correct_operators.js"
7
-
8
- Configurations:
9
-
10
- ~compiler => src/nilac.rb
1
+ Feature: This feature bring Ruby style operators to Nila
2
+ Scenario: Input file with different operators
3
+ Given the input file "operators.nila"
4
+ When the ~compiler is run
5
+ The output file must be "operators.js"
6
+ The output file must equal "correct_operators.js"
7
+
8
+ Configurations:
9
+
10
+ ~compiler => src/nilac.rb
11
11
  :v $cliusage => ruby :v --compile $file
@@ -1,11 +1,11 @@
1
- Feature: This feature bring Ruby style string interpolation to Nila
2
- Scenario: Input file with string interpolation
3
- Given the input file "string_interpolation.nila"
4
- When the ~compiler is run
5
- The output file must be "string_interpolation.js"
6
- The output file must equal "correct_string_interpolation.js"
7
-
8
- Configurations:
9
-
10
- ~compiler => src/nilac.rb
1
+ Feature: This feature bring Ruby style string interpolation to Nila
2
+ Scenario: Input file with string interpolation
3
+ Given the input file "string_interpolation.nila"
4
+ When the ~compiler is run
5
+ The output file must be "string_interpolation.js"
6
+ The output file must equal "correct_string_interpolation.js"
7
+
8
+ Configurations:
9
+
10
+ ~compiler => src/nilac.rb
11
11
  :v $cliusage => ruby :v --compile $file
@@ -1,11 +1,11 @@
1
- Feature: This feature bring Ruby's string features to Nila
2
- Scenario: Input file with different operators
3
- Given the input file "string_operators.nila"
4
- When the ~compiler is run
5
- The output file must be "string_operators.js"
6
- The output file must equal "correct_string_operators.js"
7
-
8
- Configurations:
9
-
10
- ~compiler => src/nilac.rb
1
+ Feature: This feature bring Ruby's string features to Nila
2
+ Scenario: Input file with different operators
3
+ Given the input file "string_operators.nila"
4
+ When the ~compiler is run
5
+ The output file must be "string_operators.js"
6
+ The output file must equal "correct_string_operators.js"
7
+
8
+ Configurations:
9
+
10
+ ~compiler => src/nilac.rb
11
11
  :v $cliusage => ruby :v --compile $file
@@ -1,11 +1,11 @@
1
- Feature: This feature brings Ruby's .times method to Nila
2
- Scenario: Input file with Ruby's .times method
3
- Given the input file "times.nila"
4
- When the ~compiler is run
5
- The output file must be "times.js"
6
- The output file must equal "correct_times.js"
7
-
8
- Configurations:
9
-
10
- ~compiler => src/nilac.rb
1
+ Feature: This feature brings Ruby's .times method to Nila
2
+ Scenario: Input file with Ruby's .times method
3
+ Given the input file "times.nila"
4
+ When the ~compiler is run
5
+ The output file must be "times.js"
6
+ The output file must equal "correct_times.js"
7
+
8
+ Configurations:
9
+
10
+ ~compiler => src/nilac.rb
11
11
  :v $cliusage => ruby :v --compile $file
@@ -1,11 +1,11 @@
1
- Feature: This feature bring Ruby's unless and until statements to Nila.
2
- Scenario: Input function with unless and until statements
3
- Given the input file "unless_until.nila"
4
- When the ~compiler is run
5
- The output file must be "unless_until.js"
6
- The output file must equal "correct_unless_until.js"
7
-
8
- Configurations:
9
-
10
- ~compiler => src/nilac.rb
1
+ Feature: This feature bring Ruby's unless and until statements to Nila.
2
+ Scenario: Input function with unless and until statements
3
+ Given the input file "unless_until.nila"
4
+ When the ~compiler is run
5
+ The output file must be "unless_until.js"
6
+ The output file must equal "correct_unless_until.js"
7
+
8
+ Configurations:
9
+
10
+ ~compiler => src/nilac.rb
11
11
  :v $cliusage => ruby :v --compile $file
@@ -1,11 +1,11 @@
1
- Feature: This feature brings whitespace delimitation features to Nila
2
- Scenario: Input file with whitespace delimitation features.
3
- Given the input file "whitespace_delimiter.nila"
4
- When the ~compiler is run
5
- The output file must be "whitespace_delimiter.js"
6
- The output file must equal "correct_whitespace_delimiter.js"
7
-
8
- Configurations:
9
-
10
- ~compiler => src/nilac.rb
1
+ Feature: This feature brings whitespace delimitation features to Nila
2
+ Scenario: Input file with whitespace delimitation features.
3
+ Given the input file "whitespace_delimiter.nila"
4
+ When the ~compiler is run
5
+ The output file must be "whitespace_delimiter.js"
6
+ The output file must equal "correct_whitespace_delimiter.js"
7
+
8
+ Configurations:
9
+
10
+ ~compiler => src/nilac.rb
11
11
  :v $cliusage => ruby :v --compile $file
@@ -1,21 +1,21 @@
1
- numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9]
2
-
3
- start = numbers[0..2]
4
-
5
- middle = numbers[3...6]
6
-
7
- last = numbers[6..end]
8
-
9
- copy = numbers.dup
10
-
11
- copy = numbers[..]
12
-
13
- name = "Adhithya Rajasekaran"
14
-
15
- first_name = name[0..7]
16
-
17
- second_name = name[9..end]
18
-
19
- name_copy = name.dup
20
-
21
- name_copy = name[..]
1
+ numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9]
2
+
3
+ start = numbers[0..2]
4
+
5
+ middle = numbers[3...6]
6
+
7
+ last = numbers[6..end]
8
+
9
+ copy = numbers.dup
10
+
11
+ copy = numbers[..]
12
+
13
+ name = "Adhithya Rajasekaran"
14
+
15
+ first_name = name[0..7]
16
+
17
+ second_name = name[9..end]
18
+
19
+ name_copy = name.dup
20
+
21
+ name_copy = name[..]
@@ -1,5 +1,5 @@
1
- //Written using Nila. Visit http://adhithyan15.github.io/nila
2
- (function() {
3
- console.log("Hello World!");
4
-
1
+ //Written using Nila. Visit http://adhithyan15.github.io/nila
2
+ (function() {
3
+ console.log("Hello World!");
4
+
5
5
  }).call(this);
@@ -1,23 +1,23 @@
1
- //Written using Nila. Visit http://adhithyan15.github.io/nila
2
- (function() {
3
- var container, fill, liquid;
4
-
5
- // This is a demo of default parameters
6
-
7
- fill = function(container,liquid) {
8
- if (container == null) {
9
- container = "cup";
10
- }
11
- if (liquid == null) {
12
- liquid = "coffee";
13
- }
14
- return console.log("Filling " + (container) + " with " + (liquid));
15
- };
16
-
17
- fill();
18
-
19
- fill("cup");
20
-
21
- fill("bowl","soup");
22
-
1
+ //Written using Nila. Visit http://adhithyan15.github.io/nila
2
+ (function() {
3
+ var container, fill, liquid;
4
+
5
+ // This is a demo of default parameters
6
+
7
+ fill = function(container,liquid) {
8
+ if (container == null) {
9
+ container = "cup";
10
+ }
11
+ if (liquid == null) {
12
+ liquid = "coffee";
13
+ }
14
+ return console.log("Filling " + (container) + " with " + (liquid));
15
+ };
16
+
17
+ fill();
18
+
19
+ fill("cup");
20
+
21
+ fill("bowl","soup");
22
+
23
23
  }).call(this);
@@ -1,27 +1,27 @@
1
- //Written using Nila. Visit http://adhithyan15.github.io/nila
2
- (function() {
3
- var _i, _j, _ref1, fruit, fruits, x;
4
-
5
- _ref1 = [1,2,3,4];
6
-
7
- for (_i = 0, _j = _ref1.length; _i < _j; _i += 1) {
8
- x = _ref1[_i];
9
- console.log(x);
10
- }
11
-
12
- for (x = 0, _j = 5; x <= _j; x += 1) {
13
- console.log(x);
14
- }
15
-
16
- for (x = 0, _j = 5; x < _j; x += 1) {
17
- console.log(x);
18
- }
19
-
20
- fruits = ['Apple','Banana', 'Mango'];
21
-
22
- for (_i = 0, _j = fruits.length; _i < _j; _i += 1) {
23
- fruit = fruits[_i];
24
- console.log(fruit);
25
- }
26
-
1
+ //Written using Nila. Visit http://adhithyan15.github.io/nila
2
+ (function() {
3
+ var _i, _j, _ref1, fruit, fruits, x;
4
+
5
+ _ref1 = [1,2,3,4];
6
+
7
+ for (_i = 0, _j = _ref1.length; _i < _j; _i += 1) {
8
+ x = _ref1[_i];
9
+ console.log(x);
10
+ }
11
+
12
+ for (x = 0, _j = 5; x <= _j; x += 1) {
13
+ console.log(x);
14
+ }
15
+
16
+ for (x = 0, _j = 5; x < _j; x += 1) {
17
+ console.log(x);
18
+ }
19
+
20
+ fruits = ['Apple','Banana', 'Mango'];
21
+
22
+ for (_i = 0, _j = fruits.length; _i < _j; _i += 1) {
23
+ fruit = fruits[_i];
24
+ console.log(fruit);
25
+ }
26
+
27
27
  }).call(this);
@@ -1,33 +1,33 @@
1
- //Written using Nila. Visit http://adhithyan15.github.io/nila
2
- (function() {
3
- var inst_section, student_ages, variable;
4
-
5
- // This file demonstrates several Hash features in Nila
6
-
7
- variable = 5;
8
-
9
- inst_section = {
10
- cello: 'string',
11
- clarinet: 'woodwind',
12
- drum: 'percussion',
13
- oboe: 'woodwind',
14
- trumpet: 'brass',
15
- violin: 'string',
16
- guitar: 'string',
17
- };
18
-
19
- if (variable === 10) {
20
- process.stdout.write("Variable is 10");
21
- } else if (variable === 20) {
22
- process.stdout.write("Variable is 20");
23
- } else {
24
- process.stdout.write("Variable is something else")
25
- }
26
-
27
- student_ages = {
28
- Jack: 10,
29
- Jill: 12,
30
- Bob: 14,
31
- };
32
-
1
+ //Written using Nila. Visit http://adhithyan15.github.io/nila
2
+ (function() {
3
+ var inst_section, student_ages, variable;
4
+
5
+ // This file demonstrates several Hash features in Nila
6
+
7
+ variable = 5;
8
+
9
+ inst_section = {
10
+ cello: 'string',
11
+ clarinet: 'woodwind',
12
+ drum: 'percussion',
13
+ oboe: 'woodwind',
14
+ trumpet: 'brass',
15
+ violin: 'string',
16
+ guitar: 'string',
17
+ };
18
+
19
+ if (variable === 10) {
20
+ process.stdout.write("Variable is 10");
21
+ } else if (variable === 20) {
22
+ process.stdout.write("Variable is 20");
23
+ } else {
24
+ process.stdout.write("Variable is something else")
25
+ }
26
+
27
+ student_ages = {
28
+ Jack: 10,
29
+ Jill: 12,
30
+ Bob: 14,
31
+ };
32
+
33
33
  }).call(this);
@@ -1,11 +1,11 @@
1
- //Written using Nila. Visit http://adhithyan15.github.io/nila
2
- (function() {
3
- var numbers;
4
-
5
- console.log("Grocery list\n----\n1. Salad mix.\n2. Strawberries.*\n3. Cereal.\n4. Milk.*\n \n* Organic\n");
6
-
7
- numbers = [1,2,3,4,5,6,7];
8
-
9
- numbers.push(7);
10
-
1
+ //Written using Nila. Visit http://adhithyan15.github.io/nila
2
+ (function() {
3
+ var numbers;
4
+
5
+ console.log("Grocery list\n----\n1. Salad mix.\n2. Strawberries.*\n3. Cereal.\n4. Milk.*\n \n* Organic\n");
6
+
7
+ numbers = [1,2,3,4,5,6,7];
8
+
9
+ numbers.push(7);
10
+
11
11
  }).call(this);
@@ -1,7 +1,7 @@
1
- //Written using Nila. Visit http://adhithyan15.github.io/nila
2
- (function() {
3
- var date;
4
-
5
- date = friday ? sue : jill;
6
-
1
+ //Written using Nila. Visit http://adhithyan15.github.io/nila
2
+ (function() {
3
+ var date;
4
+
5
+ date = friday ? sue : jill;
6
+
7
7
  }).call(this);
@@ -1,27 +1,27 @@
1
- //Written using Nila. Visit http://adhithyan15.github.io/nila
2
- (function() {
3
- var copy, first_name, last, middle, name, name_copy, numbers, second_name, start;
4
-
5
- numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9];
6
-
7
- start = numbers.slice(0,2+1);
8
-
9
- middle = numbers.slice(3,6);
10
-
11
- last = numbers.slice(6);
12
-
13
- copy = numbers.slice(0);
14
-
15
- copy = numbers.slice(0);
16
-
17
- name = "Adhithya Rajasekaran";
18
-
19
- first_name = name.slice(0,7+1);
20
-
21
- second_name = name.slice(9);
22
-
23
- name_copy = name.slice(0);
24
-
25
- name_copy = name.slice(0);
26
-
1
+ //Written using Nila. Visit http://adhithyan15.github.io/nila
2
+ (function() {
3
+ var copy, first_name, last, middle, name, name_copy, numbers, second_name, start;
4
+
5
+ numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9];
6
+
7
+ start = numbers.slice(0,2+1);
8
+
9
+ middle = numbers.slice(3,6);
10
+
11
+ last = numbers.slice(6);
12
+
13
+ copy = numbers.slice(0);
14
+
15
+ copy = numbers.slice(0);
16
+
17
+ name = "Adhithya Rajasekaran";
18
+
19
+ first_name = name.slice(0,7+1);
20
+
21
+ second_name = name.slice(9);
22
+
23
+ name_copy = name.slice(0);
24
+
25
+ name_copy = name.slice(0);
26
+
27
27
  }).call(this);