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,35 +1,35 @@
|
|
1
|
-
//Written using Nila. Visit http://adhithyan15.github.io/nila
|
2
|
-
(function() {
|
3
|
-
var _ref1, count, current_val, first_name, last_name, name_split, name_split1, name_split2, next_val, parse_name;
|
4
|
-
|
5
|
-
// This file demonstrates multiple variable initialization
|
6
|
-
|
7
|
-
parse_name = function(input_name) {
|
8
|
-
var name_split;
|
9
|
-
name_split = input_name.split(" ");
|
10
|
-
return [name_split[0],name_split[1]];
|
11
|
-
};
|
12
|
-
|
13
|
-
_ref1 = parse_name("Adhithya Rajasekaran");
|
14
|
-
|
15
|
-
first_name = _ref1[0];
|
16
|
-
|
17
|
-
last_name = _ref1[1];
|
18
|
-
|
19
|
-
console.log(first_name + " " + last_name);
|
20
|
-
|
21
|
-
_ref1 = [0, 1, 1];
|
22
|
-
|
23
|
-
current_val = _ref1[0];
|
24
|
-
|
25
|
-
next_val = _ref1[1];
|
26
|
-
|
27
|
-
count = _ref1[2];
|
28
|
-
|
29
|
-
_ref1 = ["Adhithya Rajasekaran".split((" "),1),"Adhithya Rajasekaran".split(" ",2)];
|
30
|
-
|
31
|
-
name_split1 = _ref1[0];
|
32
|
-
|
33
|
-
name_split2 = _ref1[1];
|
34
|
-
|
1
|
+
//Written using Nila. Visit http://adhithyan15.github.io/nila
|
2
|
+
(function() {
|
3
|
+
var _ref1, count, current_val, first_name, last_name, name_split, name_split1, name_split2, next_val, parse_name;
|
4
|
+
|
5
|
+
// This file demonstrates multiple variable initialization
|
6
|
+
|
7
|
+
parse_name = function(input_name) {
|
8
|
+
var name_split;
|
9
|
+
name_split = input_name.split(" ");
|
10
|
+
return [name_split[0],name_split[1]];
|
11
|
+
};
|
12
|
+
|
13
|
+
_ref1 = parse_name("Adhithya Rajasekaran");
|
14
|
+
|
15
|
+
first_name = _ref1[0];
|
16
|
+
|
17
|
+
last_name = _ref1[1];
|
18
|
+
|
19
|
+
console.log(first_name + " " + last_name);
|
20
|
+
|
21
|
+
_ref1 = [0, 1, 1];
|
22
|
+
|
23
|
+
current_val = _ref1[0];
|
24
|
+
|
25
|
+
next_val = _ref1[1];
|
26
|
+
|
27
|
+
count = _ref1[2];
|
28
|
+
|
29
|
+
_ref1 = ["Adhithya Rajasekaran".split((" "),1),"Adhithya Rajasekaran".split(" ",2)];
|
30
|
+
|
31
|
+
name_split1 = _ref1[0];
|
32
|
+
|
33
|
+
name_split2 = _ref1[1];
|
34
|
+
|
35
35
|
}).call(this);
|
@@ -1,15 +1,15 @@
|
|
1
|
-
//Written using Nila. Visit http://adhithyan15.github.io/nila
|
2
|
-
(function() {
|
3
|
-
var i;
|
4
|
-
|
5
|
-
i=0;
|
6
|
-
|
7
|
-
while (true) {
|
8
|
-
i+=1;
|
9
|
-
process.stdout.write("" + (i) + " ");
|
10
|
-
if (i===10) {
|
11
|
-
break;
|
12
|
-
}
|
13
|
-
}
|
14
|
-
|
1
|
+
//Written using Nila. Visit http://adhithyan15.github.io/nila
|
2
|
+
(function() {
|
3
|
+
var i;
|
4
|
+
|
5
|
+
i=0;
|
6
|
+
|
7
|
+
while (true) {
|
8
|
+
i+=1;
|
9
|
+
process.stdout.write("" + (i) + " ");
|
10
|
+
if (i===10) {
|
11
|
+
break;
|
12
|
+
}
|
13
|
+
}
|
14
|
+
|
15
15
|
}).call(this);
|
@@ -1,13 +1,13 @@
|
|
1
|
-
//Written using Nila. Visit http://adhithyan15.github.io/nila
|
2
|
-
(function() {
|
3
|
-
var myarray, name, numbers;
|
4
|
-
|
5
|
-
numbers = [1,2,3,4,5,6,7,8,9,10];
|
6
|
-
|
7
|
-
myarray = ["string 1","string 2","string 3"];
|
8
|
-
|
9
|
-
name = "Adhithya";
|
10
|
-
|
11
|
-
name[5] = "t";
|
12
|
-
|
1
|
+
//Written using Nila. Visit http://adhithyan15.github.io/nila
|
2
|
+
(function() {
|
3
|
+
var myarray, name, numbers;
|
4
|
+
|
5
|
+
numbers = [1,2,3,4,5,6,7,8,9,10];
|
6
|
+
|
7
|
+
myarray = ["string 1","string 2","string 3"];
|
8
|
+
|
9
|
+
name = "Adhithya";
|
10
|
+
|
11
|
+
name[5] = "t";
|
12
|
+
|
13
13
|
}).call(this);
|
@@ -1,21 +1,21 @@
|
|
1
|
-
//Written using Nila. Visit http://adhithyan15.github.io/nila
|
2
|
-
(function() {
|
3
|
-
var _ref1, first_name, last_name, parse_name, parsed_name, test_method;
|
4
|
-
|
5
|
-
// This method demonstrates multiple return values
|
6
|
-
|
7
|
-
parse_name = function(input_name) {
|
8
|
-
var _ref1, first_name, last_name;
|
9
|
-
_ref1 = input_name.split(" ");
|
10
|
-
first_name = _ref1[0];
|
11
|
-
last_name = _ref1[1];
|
12
|
-
return [first_name,last_name];
|
13
|
-
};
|
14
|
-
|
15
|
-
test_method = function() {
|
16
|
-
return console.log("Hello, Adhithya");
|
17
|
-
};
|
18
|
-
|
19
|
-
parsed_name = parse_name("Adhithya Rajasekaran");
|
20
|
-
|
1
|
+
//Written using Nila. Visit http://adhithyan15.github.io/nila
|
2
|
+
(function() {
|
3
|
+
var _ref1, first_name, last_name, parse_name, parsed_name, test_method;
|
4
|
+
|
5
|
+
// This method demonstrates multiple return values
|
6
|
+
|
7
|
+
parse_name = function(input_name) {
|
8
|
+
var _ref1, first_name, last_name;
|
9
|
+
_ref1 = input_name.split(" ");
|
10
|
+
first_name = _ref1[0];
|
11
|
+
last_name = _ref1[1];
|
12
|
+
return [first_name,last_name];
|
13
|
+
};
|
14
|
+
|
15
|
+
test_method = function() {
|
16
|
+
return console.log("Hello, Adhithya");
|
17
|
+
};
|
18
|
+
|
19
|
+
parsed_name = parse_name("Adhithya Rajasekaran");
|
20
|
+
|
21
21
|
}).call(this);
|
@@ -1,9 +1,9 @@
|
|
1
|
-
//Written using Nila. Visit http://adhithyan15.github.io/nila
|
2
|
-
(function() {
|
3
|
-
var million;
|
4
|
-
|
5
|
-
million = 1000000 + 7000000;
|
6
|
-
|
7
|
-
console.log(million);
|
8
|
-
|
1
|
+
//Written using Nila. Visit http://adhithyan15.github.io/nila
|
2
|
+
(function() {
|
3
|
+
var million;
|
4
|
+
|
5
|
+
million = 1000000 + 7000000;
|
6
|
+
|
7
|
+
console.log(million);
|
8
|
+
|
9
9
|
}).call(this);
|
@@ -1,17 +1,17 @@
|
|
1
|
-
//Written using Nila. Visit http://adhithyan15.github.io/nila
|
2
|
-
(function() {
|
3
|
-
var a, line;
|
4
|
-
|
5
|
-
a = Math.pow(2,3);
|
6
|
-
|
7
|
-
if (a === 8) {
|
8
|
-
console.log("Correct Calculation!");
|
9
|
-
}
|
10
|
-
|
11
|
-
line = "My favorite language is Ruby!";
|
12
|
-
|
13
|
-
if (line = line.match(/Ruby|Python/)) {
|
14
|
-
console.log("Scripting language mentioned: " + (line));
|
15
|
-
}
|
16
|
-
|
1
|
+
//Written using Nila. Visit http://adhithyan15.github.io/nila
|
2
|
+
(function() {
|
3
|
+
var a, line;
|
4
|
+
|
5
|
+
a = Math.pow(2,3);
|
6
|
+
|
7
|
+
if (a === 8) {
|
8
|
+
console.log("Correct Calculation!");
|
9
|
+
}
|
10
|
+
|
11
|
+
line = "My favorite language is Ruby!";
|
12
|
+
|
13
|
+
if (line = line.match(/Ruby|Python/)) {
|
14
|
+
console.log("Scripting language mentioned: " + (line));
|
15
|
+
}
|
16
|
+
|
17
17
|
}).call(this);
|
@@ -1,14 +1,14 @@
|
|
1
|
-
//Written using Nila. Visit http://adhithyan15.github.io/nila
|
2
|
-
(function() {
|
3
|
-
if (visitor_present) {
|
4
|
-
//This file is for demonstration purpose. It doesn't really achieve anything
|
5
|
-
if (active || happy) {
|
6
|
-
console.log("Hello Wonderful Visitor!");
|
7
|
-
} else if (idle && not_engaged) {
|
8
|
-
console.log("Hello Visitor! It is time to engage!");
|
9
|
-
} else {
|
10
|
-
console.log("Hello user!");
|
11
|
-
}
|
12
|
-
}
|
13
|
-
|
1
|
+
//Written using Nila. Visit http://adhithyan15.github.io/nila
|
2
|
+
(function() {
|
3
|
+
if (visitor_present) {
|
4
|
+
//This file is for demonstration purpose. It doesn't really achieve anything
|
5
|
+
if (active || happy) {
|
6
|
+
console.log("Hello Wonderful Visitor!");
|
7
|
+
} else if (idle && not_engaged) {
|
8
|
+
console.log("Hello Visitor! It is time to engage!");
|
9
|
+
} else {
|
10
|
+
console.log("Hello user!");
|
11
|
+
}
|
12
|
+
}
|
13
|
+
|
14
14
|
}).call(this);
|
@@ -1,14 +1,14 @@
|
|
1
|
-
//Written using Nila. Visit http://adhithyan15.github.io/nila
|
2
|
-
(function() {
|
3
|
-
var counter;
|
4
|
-
|
5
|
-
// This file will demonstrate Nila's while loops
|
6
|
-
|
7
|
-
counter = 1;
|
8
|
-
|
9
|
-
while (counter < 11) {
|
10
|
-
console.log(counter);
|
11
|
-
counter = counter + 1;
|
12
|
-
}
|
13
|
-
|
1
|
+
//Written using Nila. Visit http://adhithyan15.github.io/nila
|
2
|
+
(function() {
|
3
|
+
var counter;
|
4
|
+
|
5
|
+
// This file will demonstrate Nila's while loops
|
6
|
+
|
7
|
+
counter = 1;
|
8
|
+
|
9
|
+
while (counter < 11) {
|
10
|
+
console.log(counter);
|
11
|
+
counter = counter + 1;
|
12
|
+
}
|
13
|
+
|
14
14
|
}).call(this);
|
@@ -1,11 +1,11 @@
|
|
1
|
-
//Written using Nila. Visit http://adhithyan15.github.io/nila
|
2
|
-
(function() {
|
3
|
-
var subtract;
|
4
|
-
|
5
|
-
subtract = function(num1,num2) {
|
6
|
-
return num1-num2;
|
7
|
-
};
|
8
|
-
|
9
|
-
console.log(subtract(7,8));
|
10
|
-
|
1
|
+
//Written using Nila. Visit http://adhithyan15.github.io/nila
|
2
|
+
(function() {
|
3
|
+
var subtract;
|
4
|
+
|
5
|
+
subtract = function(num1,num2) {
|
6
|
+
return num1-num2;
|
7
|
+
};
|
8
|
+
|
9
|
+
console.log(subtract(7,8));
|
10
|
+
|
11
11
|
}).call(this);
|
@@ -1,11 +1,11 @@
|
|
1
|
-
//Written using Nila. Visit http://adhithyan15.github.io/nila
|
2
|
-
(function() {
|
3
|
-
var subtract;
|
4
|
-
|
5
|
-
subtract = function(num1,num2) {
|
6
|
-
return num1-num2;
|
7
|
-
};
|
8
|
-
|
9
|
-
console.log(subtract(7,8));
|
10
|
-
|
1
|
+
//Written using Nila. Visit http://adhithyan15.github.io/nila
|
2
|
+
(function() {
|
3
|
+
var subtract;
|
4
|
+
|
5
|
+
subtract = function(num1,num2) {
|
6
|
+
return num1-num2;
|
7
|
+
};
|
8
|
+
|
9
|
+
console.log(subtract(7,8));
|
10
|
+
|
11
11
|
}).call(this);
|
@@ -1,17 +1,17 @@
|
|
1
|
-
//Written using Nila. Visit http://adhithyan15.github.io/nila
|
2
|
-
(function() {
|
3
|
-
var msg;
|
4
|
-
|
5
|
-
//This file tests the limits of the string interpolation feature present in Nila
|
6
|
-
|
7
|
-
msg = "Hello " + ("world. A lovely place.") + "" + "Another " + ("Lovely quote");
|
8
|
-
|
9
|
-
console.log(msg);
|
10
|
-
|
11
|
-
console.log("Hello " + ("world"));
|
12
|
-
|
13
|
-
console.log('Hello #{world}');
|
14
|
-
|
15
|
-
console.log('Hello');
|
16
|
-
|
1
|
+
//Written using Nila. Visit http://adhithyan15.github.io/nila
|
2
|
+
(function() {
|
3
|
+
var msg;
|
4
|
+
|
5
|
+
//This file tests the limits of the string interpolation feature present in Nila
|
6
|
+
|
7
|
+
msg = "Hello " + ("world. A lovely place.") + "" + "Another " + ("Lovely quote");
|
8
|
+
|
9
|
+
console.log(msg);
|
10
|
+
|
11
|
+
console.log("Hello " + ("world"));
|
12
|
+
|
13
|
+
console.log('Hello #{world}');
|
14
|
+
|
15
|
+
console.log('Hello');
|
16
|
+
|
17
17
|
}).call(this);
|
@@ -1,25 +1,25 @@
|
|
1
|
-
//Written using Nila. Visit http://adhithyan15.github.io/nila
|
2
|
-
(function() {
|
3
|
-
var str;
|
4
|
-
|
5
|
-
// This file demonstrates different ways to declare a string
|
6
|
-
|
7
|
-
str = 'this is a wonderful string';
|
8
|
-
|
9
|
-
str = 'this is a wonderful string';
|
10
|
-
|
11
|
-
str = 'this is a wonderful string' + 'this is another wonderful string';
|
12
|
-
|
13
|
-
str = "this is a wonderful string";
|
14
|
-
|
15
|
-
str = "this is a wonderful string";
|
16
|
-
|
17
|
-
str = "this is a wonderful string" + "this is another wonderful string";
|
18
|
-
|
19
|
-
str = "this is a wonderful string";
|
20
|
-
|
21
|
-
str = "this is a wonderful string";
|
22
|
-
|
23
|
-
str = "this is a wonderful string" + "this is another wonderful string";
|
24
|
-
|
1
|
+
//Written using Nila. Visit http://adhithyan15.github.io/nila
|
2
|
+
(function() {
|
3
|
+
var str;
|
4
|
+
|
5
|
+
// This file demonstrates different ways to declare a string
|
6
|
+
|
7
|
+
str = 'this is a wonderful string';
|
8
|
+
|
9
|
+
str = 'this is a wonderful string';
|
10
|
+
|
11
|
+
str = 'this is a wonderful string' + 'this is another wonderful string';
|
12
|
+
|
13
|
+
str = "this is a wonderful string";
|
14
|
+
|
15
|
+
str = "this is a wonderful string";
|
16
|
+
|
17
|
+
str = "this is a wonderful string" + "this is another wonderful string";
|
18
|
+
|
19
|
+
str = "this is a wonderful string";
|
20
|
+
|
21
|
+
str = "this is a wonderful string";
|
22
|
+
|
23
|
+
str = "this is a wonderful string" + "this is another wonderful string";
|
24
|
+
|
25
25
|
}).call(this);
|
@@ -1,24 +1,24 @@
|
|
1
|
-
//Written using Nila. Visit http://adhithyan15.github.io/nila
|
2
|
-
(function() {
|
3
|
-
var _i, _j, a;
|
4
|
-
|
5
|
-
a = 5;
|
6
|
-
|
7
|
-
for (_i = 0, _j = 10; _i < _j; _i += 1) {
|
8
|
-
(function(n) {
|
9
|
-
console.log("The number is " + (a+n) + "");
|
10
|
-
}(_i));
|
11
|
-
}
|
12
|
-
|
13
|
-
for (_i = 0, _j = 10; _i < _j; _i += 1) {
|
14
|
-
console.log("Hello");
|
15
|
-
}
|
16
|
-
|
17
|
-
for (_i = 0, _j = 10; _i < _j; _i += 1) {
|
18
|
-
(function(n) {
|
19
|
-
console.log("The number is " + (n));
|
20
|
-
console.log("Twice the number is " + (2*n) + "");
|
21
|
-
}(_i));
|
22
|
-
}
|
23
|
-
|
1
|
+
//Written using Nila. Visit http://adhithyan15.github.io/nila
|
2
|
+
(function() {
|
3
|
+
var _i, _j, a;
|
4
|
+
|
5
|
+
a = 5;
|
6
|
+
|
7
|
+
for (_i = 0, _j = 10; _i < _j; _i += 1) {
|
8
|
+
(function(n) {
|
9
|
+
console.log("The number is " + (a+n) + "");
|
10
|
+
}(_i));
|
11
|
+
}
|
12
|
+
|
13
|
+
for (_i = 0, _j = 10; _i < _j; _i += 1) {
|
14
|
+
console.log("Hello");
|
15
|
+
}
|
16
|
+
|
17
|
+
for (_i = 0, _j = 10; _i < _j; _i += 1) {
|
18
|
+
(function(n) {
|
19
|
+
console.log("The number is " + (n));
|
20
|
+
console.log("Twice the number is " + (2*n) + "");
|
21
|
+
}(_i));
|
22
|
+
}
|
23
|
+
|
24
24
|
}).call(this);
|