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.
- checksums.yaml +4 -4
- data/.gitignore +17 -17
- data/Gemfile +4 -4
- data/LICENSE +20 -20
- data/README.md +67 -67
- data/Rakefile +2 -2
- data/bin/nilac +4734 -4734
- data/lib/nilac.rb +5 -5
- data/lib/nilac/version.rb +3 -3
- data/nilac.gemspec +19 -19
- data/shark/features/add_auto_return_statement.feature +17 -17
- data/shark/features/array_and_string_indexing.feature +10 -10
- data/shark/features/barebones_compilation.feature +10 -10
- data/shark/features/default_method_parameters.feature +11 -11
- data/shark/features/fix_newlines.feature +12 -12
- data/shark/features/hashes.feature +10 -10
- data/shark/features/heredoc.feature +10 -10
- data/shark/features/if_then_else.feature +10 -10
- data/shark/features/loop.feature +10 -10
- data/shark/features/method_multiple_return.feature +16 -16
- data/shark/features/multiline_array.feature +10 -10
- data/shark/features/multiple_variable_initialization.feature +11 -11
- data/shark/features/numbers.feature +10 -10
- data/shark/features/regular_for.feature +10 -10
- data/shark/features/regular_if.feature +10 -10
- data/shark/features/regular_while.feature +10 -10
- data/shark/features/ruby_operators.feature +10 -10
- data/shark/features/string_interpolation.feature +10 -10
- data/shark/features/strings.feature +10 -10
- data/shark/features/times.feature +10 -10
- data/shark/features/unless_until.feature +10 -10
- data/shark/features/whitespace_delimitation.feature +10 -10
- data/shark/test_files/array_string_indexing.nila +21 -21
- data/shark/test_files/correct.js +4 -4
- data/shark/test_files/correct_default_parameters.js +22 -22
- data/shark/test_files/correct_for.js +26 -26
- data/shark/test_files/correct_hashes.js +32 -32
- data/shark/test_files/correct_heredoc.js +10 -10
- data/shark/test_files/correct_if_then_else.js +6 -6
- data/shark/test_files/correct_indexing.js +26 -26
- data/shark/test_files/correct_initialization.js +34 -34
- data/shark/test_files/correct_loop.js +14 -14
- data/shark/test_files/correct_multiline_array.js +12 -12
- data/shark/test_files/correct_multiple_return.js +20 -20
- data/shark/test_files/correct_numbers.js +8 -8
- data/shark/test_files/correct_operators.js +16 -16
- data/shark/test_files/correct_regular_if.js +13 -13
- data/shark/test_files/correct_regular_while.js +13 -13
- data/shark/test_files/correct_return.js +10 -10
- data/shark/test_files/correct_single_return.js +10 -10
- data/shark/test_files/correct_string_interpolation.js +16 -16
- data/shark/test_files/correct_string_operators.js +24 -24
- data/shark/test_files/correct_times.js +23 -23
- data/shark/test_files/correct_unless_until.js +28 -28
- data/shark/test_files/correct_whitespace_delimiter.js +16 -16
- data/shark/test_files/default_parameters.nila +12 -12
- data/shark/test_files/erratic.nila +22 -22
- data/shark/test_files/hashes.nila +22 -22
- data/shark/test_files/heredoc.nila +13 -13
- data/shark/test_files/loop.nila +5 -5
- data/shark/test_files/multiline_array.nila +12 -12
- data/shark/test_files/multiple_initialization.nila +16 -16
- data/shark/test_files/multiple_return.nila +16 -16
- data/shark/test_files/no_return.nila +6 -6
- data/shark/test_files/numbers.nila +2 -2
- data/shark/test_files/operators.nila +8 -8
- data/shark/test_files/perfect.js +16 -16
- data/shark/test_files/regular_for.nila +16 -16
- data/shark/test_files/regular_if.nila +19 -19
- data/shark/test_files/regular_while.nila +6 -6
- data/shark/test_files/ruby_methods.nila +24 -0
- data/shark/test_files/single_return.nila +6 -6
- data/shark/test_files/string_interpolation.nila +10 -10
- data/shark/test_files/string_operators.nila +19 -19
- data/shark/test_files/times.nila +12 -12
- data/shark/test_files/unless_until.nila +16 -16
- data/shark/test_files/whitespace_delimiter.nila +16 -16
- data/src/nilac.rb +4766 -4732
- 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[..]
|
data/shark/test_files/correct.js
CHANGED
@@ -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);
|