nilac 0.0.4.2.6 → 0.0.4.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/bin/nilac CHANGED
@@ -387,19 +387,19 @@ def compile(input_file_path, *output_file_name)
387
387
 
388
388
  if string_split[1].eql?("\"\n")
389
389
 
390
- replacement_string = "\" + " + interpol[2...-1]
390
+ replacement_string = "\" + " + "(#{interpol[2...-1]})"
391
391
 
392
392
  modified_file_contents[index] = modified_file_contents[index].sub(interpol+"\"", replacement_string)
393
393
 
394
394
  elsif string_split[1].eql?("\")\n")
395
395
 
396
- replacement_string = "\" + " + interpol[2...-1]
396
+ replacement_string = "\" + " + "(#{interpol[2...-1]})"
397
397
 
398
- modified_file_contents[index] = modified_file_contents[index].sub(interpol+"\"", replacement_string)
398
+ modified_file_contents[index] = modified_file_contents[index].sub(interpol + "\"", replacement_string)
399
399
 
400
400
  else
401
401
 
402
- replacement_string = "\" + " + interpol[2...-1] + " + \""
402
+ replacement_string = "\"" + " + " + "(#{interpol[2...-1]})" + " + \""
403
403
 
404
404
  modified_file_contents[index] = modified_file_contents[index].sub(interpol, replacement_string)
405
405
 
@@ -686,7 +686,7 @@ def compile(input_file_path, *output_file_name)
686
686
 
687
687
  replacement_parameters << param.lstrip.rstrip
688
688
 
689
- replacement_string = replacement_string + "\n" + "if (#{param.lstrip.rstrip} == null) {\n #{paramvalue.lstrip.rstrip}\n}\n" +"\n"
689
+ replacement_string = replacement_string + "\n" + "if (#{param.lstrip.rstrip} equequ null) {\n #{paramvalue.lstrip.rstrip}\n}\n" +"\n"
690
690
 
691
691
  end
692
692
 
@@ -734,7 +734,7 @@ def compile(input_file_path, *output_file_name)
734
734
 
735
735
  end
736
736
 
737
- def get_variables(input_file_contents, temporary_nila_file)
737
+ def get_variables(input_file_contents, temporary_nila_file, *loop_variables)
738
738
 
739
739
  variables = []
740
740
 
@@ -754,11 +754,13 @@ def compile(input_file_path, *output_file_name)
754
754
 
755
755
  input_file_contents = input_file_contents.collect { |element| element.gsub("=~", "matchequal") }
756
756
 
757
+ javascript_regexp = /(if |while |for )/
758
+
757
759
  for x in 0...input_file_contents.length
758
760
 
759
761
  current_row = input_file_contents[x]
760
762
 
761
- if current_row.include?("=") and !current_row.include?("def")
763
+ if current_row.include?("=") and current_row.index(javascript_regexp) == nil
762
764
 
763
765
  current_row = current_row.rstrip + "\n"
764
766
 
@@ -796,6 +798,10 @@ def compile(input_file_path, *output_file_name)
796
798
 
797
799
  line_by_line_contents = read_file_line_by_line(temporary_nila_file)
798
800
 
801
+ variables += loop_variables
802
+
803
+ variables = variables.flatten
804
+
799
805
  if variables.length > 0
800
806
 
801
807
  variable_declaration_string = "var " + variables.uniq.sort.join(", ") + "\n\n"
@@ -1146,10 +1152,14 @@ def compile(input_file_path, *output_file_name)
1146
1152
 
1147
1153
  def compile_multiline_hashes(input_file_contents,temporary_nila_file)
1148
1154
 
1155
+ javascript_regexp = /(if |while |for |function |function\()/
1156
+
1149
1157
  possible_hashes = input_file_contents.reject { |element| !element.include?("{") }
1150
1158
 
1151
1159
  possible_multiline_hashes = possible_hashes.reject { |element| element.include?("}") }
1152
1160
 
1161
+ possible_multiline_hashes = possible_multiline_hashes.reject {|element| element.index(javascript_regexp) != nil}
1162
+
1153
1163
  multiline_hashes = []
1154
1164
 
1155
1165
  possible_multiline_hashes.each do |starting_line|
@@ -1158,7 +1168,7 @@ def compile(input_file_path, *output_file_name)
1158
1168
 
1159
1169
  line = starting_line
1160
1170
 
1161
- until line.include?("}")
1171
+ until line.include?("}\n")
1162
1172
 
1163
1173
  index += 1
1164
1174
 
@@ -1200,12 +1210,48 @@ def compile(input_file_path, *output_file_name)
1200
1210
 
1201
1211
  def compile_inline_hashes(input_file_contents)
1202
1212
 
1203
- modified_file_contents = input_file_contents.clone.collect {|element| element.gsub(/(#|%)\w?\{/,"innerrii0opol115")}
1213
+ def replace_strings(input_string)
1214
+
1215
+ string_counter = 0
1216
+
1217
+ while input_string.include?("\"")
1218
+
1219
+ string_extract = input_string[input_string.index("\"")..input_string.index("\"",input_string.index("\"")+1)]
1220
+
1221
+ input_string = input_string.sub(string_extract,"--repstring#{string_counter}")
1222
+
1223
+ string_counter += 1
1224
+
1225
+ end
1226
+
1227
+ while input_string.include?("'")
1228
+
1229
+ string_extract = input_string[input_string.index("'")..input_string.index("'",input_string.index("'")+1)]
1230
+
1231
+ input_string = input_string.sub(string_extract,"--repstring#{string_counter}")
1232
+
1233
+ string_counter += 1
1204
1234
 
1205
- possible_inline_hashes = modified_file_contents.reject {|element| !element.include?("{")}
1235
+ end
1236
+
1237
+ return input_string
1238
+
1239
+ end
1240
+
1241
+ javascript_regexp = /(if |while |for |function |function\(|%[qQ]*\{)/
1242
+
1243
+ modified_file_contents = input_file_contents.clone.collect {|element| replace_strings(element)}
1244
+
1245
+ possible_inline_hashes = modified_file_contents.reject {|element| element.count("{") != 1}
1246
+
1247
+ possible_inline_hashes = possible_inline_hashes.reject {|element| element.count("}") != 1}
1248
+
1249
+ possible_inline_hashes = possible_inline_hashes.reject {|element| element.index(javascript_regexp) != nil}
1206
1250
 
1207
1251
  possible_inline_hashes.each do |hash|
1208
1252
 
1253
+ hash = input_file_contents[modified_file_contents.index(hash)]
1254
+
1209
1255
  hash_extract = hash[hash.index("{")..hash.index("}")]
1210
1256
 
1211
1257
  contents = hash_extract[1...-1].split(",")
@@ -1390,6 +1436,30 @@ def compile(input_file_path, *output_file_name)
1390
1436
 
1391
1437
  end
1392
1438
 
1439
+ def compile_integers(input_file_contents)
1440
+
1441
+ modified_file_contents = input_file_contents.clone
1442
+
1443
+ input_file_contents.each_with_index do |line,index|
1444
+
1445
+ matches = line.scan(/(([0-9]+_)+([0-9]+|$))/)
1446
+
1447
+ unless matches.empty?
1448
+
1449
+ matches.each do |match_arr|
1450
+
1451
+ modified_file_contents[index] = modified_file_contents[index].sub(match_arr[0],match_arr[0].gsub("_",""))
1452
+
1453
+ end
1454
+
1455
+ end
1456
+
1457
+ end
1458
+
1459
+ return modified_file_contents
1460
+
1461
+ end
1462
+
1393
1463
  def compile_named_functions(input_file_contents, named_code_blocks, nested_functions, temporary_nila_file)
1394
1464
 
1395
1465
  #This method compiles all the named Nila functions. Below is an example of what is meant
@@ -1403,11 +1473,11 @@ def compile(input_file_path, *output_file_name)
1403
1473
 
1404
1474
  #The above function will compile to
1405
1475
 
1406
- #function square(input_number) {
1476
+ #square = function(input_number) {
1407
1477
  #
1408
1478
  # return input_number*input_number;
1409
1479
  #
1410
- #}
1480
+ #};
1411
1481
 
1412
1482
  def is_parameterless?(input_function_block)
1413
1483
 
@@ -1658,6 +1728,16 @@ def compile(input_file_path, *output_file_name)
1658
1728
 
1659
1729
  end
1660
1730
 
1731
+ def coffee_type_function(input_array)
1732
+
1733
+ function_name = input_array[0].split("function ")[1].split("(")[0].lstrip
1734
+
1735
+ input_array[0] = "#{function_name} = function(" + input_array[0].split("function ")[1].split("(")[1].lstrip
1736
+
1737
+ return input_array
1738
+
1739
+ end
1740
+
1661
1741
  def compile_function(input_array, temporary_nila_file)
1662
1742
 
1663
1743
  modified_input_array = input_array.dup
@@ -1718,7 +1798,7 @@ def compile(input_file_path, *output_file_name)
1718
1798
 
1719
1799
  end
1720
1800
 
1721
- modified_input_array[-1] = input_array[-1].sub "end", "}\n"
1801
+ modified_input_array[-1] = input_array[-1].sub "end", "};\n"
1722
1802
 
1723
1803
  modified_input_array = compile_parallel_assignment(modified_input_array, temporary_nila_file)
1724
1804
 
@@ -1738,6 +1818,8 @@ def compile(input_file_path, *output_file_name)
1738
1818
 
1739
1819
  modified_input_array = compile_multiple_return(modified_input_array)
1740
1820
 
1821
+ modified_input_array = coffee_type_function(modified_input_array)
1822
+
1741
1823
  return modified_input_array
1742
1824
 
1743
1825
  end
@@ -1875,7 +1957,13 @@ def compile(input_file_path, *output_file_name)
1875
1957
 
1876
1958
  extracted_string = input_string[location..-1]
1877
1959
 
1878
- pattern << extracted_string[0..extracted_string.index(pattern_end)]
1960
+ string_extract = extracted_string[0..extracted_string.index(pattern_end)]
1961
+
1962
+ if !string_extract.include?(" = function(")
1963
+
1964
+ pattern << string_extract
1965
+
1966
+ end
1879
1967
 
1880
1968
  end
1881
1969
 
@@ -2981,6 +3069,110 @@ def compile(input_file_path, *output_file_name)
2981
3069
 
2982
3070
  end
2983
3071
 
3072
+ def compile_loops(input_file_contents,temporary_nila_file)
3073
+
3074
+ def compile_times_loop(input_file_contents,temporary_nila_file)
3075
+
3076
+ def compile_one_line_blocks(input_block)
3077
+
3078
+ block_parameters, block_contents = input_block[1...-1].split("|",2)[1].split("|",2)
3079
+
3080
+ compiled_block = "(function(#{block_parameters.lstrip.rstrip}) {\n\n #{block_contents} \n\n}(_i))_!;\n"
3081
+
3082
+ return compiled_block
3083
+
3084
+ end
3085
+
3086
+ modified_file_contents = input_file_contents.clone
3087
+
3088
+ possible_times_loop = input_file_contents.reject{ |element| !element.include?(".times")}
3089
+
3090
+ oneliner_times_loop = possible_times_loop.reject {|element| !element.include?("{") and !element.include?("}")}
3091
+
3092
+ #multiline_times_loop = possible_times_loop-oneliner_times_loop
3093
+
3094
+ #multiline_times_loop = multiline_times_loop.reject {|element| !element.include?(" do ")}
3095
+
3096
+ loop_variables = []
3097
+
3098
+ unless oneliner_times_loop.empty?
3099
+
3100
+ oneliner_times_loop.each do |loop|
3101
+
3102
+ original_loop = loop.clone
3103
+
3104
+ string_counter = 1
3105
+
3106
+ extracted_string = []
3107
+
3108
+ while loop.include?("\"")
3109
+
3110
+ string_extract = loop[loop.index("\"")..loop.index("\"",loop.index("\"")+1)]
3111
+
3112
+ extracted_string << string_extract
3113
+
3114
+ loop = loop.sub(string_extract,"--repstring#{string_counter}")
3115
+
3116
+ string_counter += 1
3117
+
3118
+ end
3119
+
3120
+ block_extract = loop[loop.index("{")..loop.index("}")]
3121
+
3122
+ compiled_block = ""
3123
+
3124
+ if block_extract.count("|") == 2
3125
+
3126
+ compiled_block = compile_one_line_blocks(block_extract)
3127
+
3128
+ extracted_string.each_with_index do |string,index|
3129
+
3130
+ compiled_block = compiled_block.sub("--repstring#{index+1}",string)
3131
+
3132
+ end
3133
+
3134
+ else
3135
+
3136
+ compiled_block = block_extract[1...-1].lstrip.rstrip
3137
+
3138
+ extracted_string.each_with_index do |string,index|
3139
+
3140
+ compiled_block = compiled_block.sub("--repstring#{index+1}",string)
3141
+
3142
+ end
3143
+
3144
+ end
3145
+
3146
+ times_counter = loop.split(".times")[0].lstrip
3147
+
3148
+ replacement_string = "for (_i = 0, _j = #{times_counter}; _i < _j; _i += 1) {\n\n#{compiled_block}\n\n}"
3149
+
3150
+ modified_file_contents[input_file_contents.index(original_loop)] = replacement_string
3151
+
3152
+ end
3153
+
3154
+ loop_variables = ["_i","_j"]
3155
+
3156
+ end
3157
+
3158
+ file_id = open(temporary_nila_file, 'w')
3159
+
3160
+ file_id.write(modified_file_contents.join)
3161
+
3162
+ file_id.close()
3163
+
3164
+ line_by_line_contents = read_file_line_by_line(temporary_nila_file)
3165
+
3166
+ return line_by_line_contents,loop_variables
3167
+
3168
+ end
3169
+
3170
+ file_contents,loop_variables = compile_times_loop(input_file_contents,temporary_nila_file)
3171
+
3172
+ return file_contents,loop_variables
3173
+
3174
+ end
3175
+
2984
3176
  def add_semicolons(input_file_contents)
2985
3177
 
2986
3178
  def comment(input_string)
@@ -3282,7 +3474,7 @@ def compile(input_file_path, *output_file_name)
3282
3474
 
3283
3475
  if !code_block_starting_locations.empty?
3284
3476
 
3285
- controlregexp = /(if |while |function |function\(|((=|:)\s+\{))/
3477
+ controlregexp = /(if |for |while |\(function\(|= function\(|((=|:)\s+\{))/
3286
3478
 
3287
3479
  code_block_starting_locations = [0, code_block_starting_locations, -1].flatten
3288
3480
 
@@ -3296,6 +3488,12 @@ def compile(input_file_path, *output_file_name)
3296
3488
 
3297
3489
  possible_blocks << input_file_contents[code_block_starting_locations[x]..code_block_starting_locations[x+1]]
3298
3490
 
3491
+ if possible_blocks.length > 1
3492
+
3493
+ possible_blocks[-1] = possible_blocks[-1][1..-1]
3494
+
3495
+ end
3496
+
3299
3497
  end
3300
3498
 
3301
3499
  end_counter = 0
@@ -3306,11 +3504,19 @@ def compile(input_file_path, *output_file_name)
3306
3504
 
3307
3505
  possible_blocks.each_with_index do |block|
3308
3506
 
3309
- current_block += block
3507
+ if !block[0].eql?(current_block[-1])
3508
+
3509
+ current_block += block
3510
+
3511
+ else
3512
+
3513
+ current_block += block[1..-1]
3514
+
3515
+ end
3310
3516
 
3311
3517
  current_block.each_with_index do |line, index|
3312
3518
 
3313
- if line.lstrip.eql? "}\n" or line.lstrip.eql?("};\n")
3519
+ if line.lstrip.eql? "}\n" or line.lstrip.eql?("};\n") or line.lstrip.include?("_!;\n")
3314
3520
 
3315
3521
  end_counter += 1
3316
3522
 
@@ -3354,7 +3560,7 @@ def compile(input_file_path, *output_file_name)
3354
3560
 
3355
3561
  current_block.each_with_index do |line, index|
3356
3562
 
3357
- if line.lstrip.eql? "}\n"
3563
+ if line.lstrip.eql? "}\n" or line.lstrip.eql?("};\n") or line.lstrip.include?("_!;\n")
3358
3564
 
3359
3565
  end_counter += 1
3360
3566
 
@@ -3412,7 +3618,7 @@ def compile(input_file_path, *output_file_name)
3412
3618
 
3413
3619
  end
3414
3620
 
3415
- javascript_regexp = /(if |while |function |function\(|((=|:)\s+\{))/
3621
+ javascript_regexp = /(if |for |while |\(function\(|= function\(|((=|:)\s+\{))/
3416
3622
 
3417
3623
  javascript_file_contents = javascript_file_contents.collect { |element| element.sub("Euuf", "if") }
3418
3624
 
@@ -3626,12 +3832,16 @@ def compile(input_file_path, *output_file_name)
3626
3832
 
3627
3833
  input_file_contents = input_file_contents.collect { |element| element.sub("!=", "!==") }
3628
3834
 
3835
+ input_file_contents = input_file_contents.collect { |element| element.sub("equequ", "==") }
3836
+
3629
3837
  input_file_contents = input_file_contents.collect { |element| element.sub("elsuf", "else if") }
3630
3838
 
3631
3839
  input_file_contents = input_file_contents.collect { |element| compile_power_operator(element) }
3632
3840
 
3633
3841
  input_file_contents = input_file_contents.collect {|element| compile_match_operator(element)}
3634
3842
 
3843
+ input_file_contents = input_file_contents.collect {|element| element.gsub("_!;",";")}
3844
+
3635
3845
  return input_file_contents
3636
3846
 
3637
3847
  end
@@ -3669,6 +3879,8 @@ def compile(input_file_path, *output_file_name)
3669
3879
 
3670
3880
  file_contents = compile_heredocs(file_contents, temp_file)
3671
3881
 
3882
+ file_contents,loop_vars = compile_loops(file_contents,temp_file)
3883
+
3672
3884
  file_contents = compile_interpolated_strings(file_contents)
3673
3885
 
3674
3886
  file_contents = compile_hashes(file_contents,temp_file)
@@ -3679,6 +3891,8 @@ def compile(input_file_path, *output_file_name)
3679
3891
 
3680
3892
  file_contents = compile_strings(file_contents)
3681
3893
 
3894
+ file_contents = compile_integers(file_contents)
3895
+
3682
3896
  file_contents = compile_default_values(file_contents, temp_file)
3683
3897
 
3684
3898
  file_contents, named_functions, nested_functions = replace_named_functions(file_contents, temp_file)
@@ -3687,14 +3901,16 @@ def compile(input_file_path, *output_file_name)
3687
3901
 
3688
3902
  file_contents = compile_parallel_assignment(file_contents, temp_file)
3689
3903
 
3690
- list_of_variables, file_contents = get_variables(file_contents, temp_file)
3691
-
3692
3904
  file_contents, function_names = compile_named_functions(file_contents, named_functions, nested_functions, temp_file)
3693
3905
 
3906
+ list_of_variables, file_contents = get_variables(file_contents, temp_file,loop_vars)
3907
+
3694
3908
  file_contents, ruby_functions = compile_custom_function_map(file_contents)
3695
3909
 
3696
3910
  function_names << ruby_functions
3697
3911
 
3912
+ list_of_variables += loop_vars
3913
+
3698
3914
  file_contents = compile_whitespace_delimited_functions(file_contents, function_names, temp_file)
3699
3915
 
3700
3916
  file_contents = remove_question_marks(file_contents, list_of_variables, temp_file)
@@ -3773,7 +3989,7 @@ def find_file_path(input_path, file_extension)
3773
3989
 
3774
3990
  end
3775
3991
 
3776
- nilac_version = "0.0.4.2.6"
3992
+ nilac_version = "0.0.4.2.8"
3777
3993
 
3778
3994
  opts = Slop.parse do
3779
3995
  on :c, :compile=, 'Compile Nila File', as:Array, delimiter:":"
data/lib/nilac/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Nilac
2
- VERSION = "0.0.4.2.6"
2
+ VERSION = "0.0.4.2.8"
3
3
  end
@@ -0,0 +1,11 @@
1
+ Feature: This feature brings single line if-then-else statement to Nila
2
+ Scenario: Input file with single line if-then-else statement.
3
+ Given the input file "if_then_else.nila"
4
+ When the ~compiler is run
5
+ The output file must be "if_then_else.js"
6
+ The output file must equal "correct_if_then_else.js"
7
+
8
+ Configurations:
9
+
10
+ ~compiler => src/nilac.rb
11
+ :v $cliusage => ruby :v --compile $file
@@ -0,0 +1,11 @@
1
+ Feature: This feature brings Ruby's number features to Nila
2
+ Scenario: Input file with Ruby's number features.
3
+ Given the input file "numbers.nila"
4
+ When the ~compiler is run
5
+ The output file must be "numbers.js"
6
+ The output file must equal "correct_numbers.js"
7
+
8
+ Configurations:
9
+
10
+ ~compiler => src/nilac.rb
11
+ :v $cliusage => ruby :v --compile $file
@@ -0,0 +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
11
+ :v $cliusage => ruby :v --compile $file
@@ -1,16 +1,18 @@
1
1
  //Written using Nila. Visit http://adhithyan15.github.io/nila
2
2
  (function() {
3
+ var container, fill, liquid;
4
+
3
5
  // This is a demo of default parameters
4
6
 
5
- function fill(container,liquid) {
6
- if (container === null) {
7
+ fill = function(container,liquid) {
8
+ if (container == null) {
7
9
  container = "cup";
8
10
  }
9
- if (liquid === null) {
11
+ if (liquid == null) {
10
12
  liquid = "coffee";
11
13
  }
12
- return console.log("Filling " + container + " with " + liquid);
13
- }
14
+ return console.log("Filling " + (container) + " with " + (liquid));
15
+ };
14
16
 
15
17
  fill();
16
18
 
@@ -1,9 +1,11 @@
1
1
  //Written using Nila. Visit http://adhithyan15.github.io/nila
2
2
  (function() {
3
- var inst_section, student_ages;
3
+ var inst_section, student_ages, variable;
4
4
 
5
5
  // This file demonstrates several Hash features in Nila
6
6
 
7
+ variable = 5;
8
+
7
9
  inst_section = {
8
10
  cello: 'string',
9
11
  clarinet: 'woodwind',
@@ -0,0 +1,7 @@
1
+ //Written using Nila. Visit http://adhithyan15.github.io/nila
2
+ (function() {
3
+ var date;
4
+
5
+ date = friday ? sue : jill;
6
+
7
+ }).call(this);
@@ -1,14 +1,14 @@
1
1
  //Written using Nila. Visit http://adhithyan15.github.io/nila
2
2
  (function() {
3
- var _ref1, first_name, last_name;
3
+ var _ref1, first_name, last_name, name_split, parse_name;
4
4
 
5
5
  // This file demonstrates multiple variable initialization
6
6
 
7
- function parse_name(input_name) {
7
+ parse_name = function(input_name) {
8
8
  var name_split;
9
9
  name_split = input_name.split(" ");
10
10
  return [name_split[0],name_split[1]];
11
- }
11
+ };
12
12
 
13
13
  _ref1 = parse_name("Adhithya Rajasekaran");
14
14
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  while (true) {
8
8
  i+=1;
9
- process.stdout.write("" + i + " ");
9
+ process.stdout.write("" + (i) + " ");
10
10
  if (i===10) {
11
11
  break;
12
12
  }
@@ -1,20 +1,20 @@
1
1
  //Written using Nila. Visit http://adhithyan15.github.io/nila
2
2
  (function() {
3
- var parsed_name;
3
+ var _ref1, first_name, last_name, parse_name, parsed_name, test_method;
4
4
 
5
5
  // This method demonstrates multiple return values
6
6
 
7
- function parse_name(input_name) {
7
+ parse_name = function(input_name) {
8
8
  var _ref1, first_name, last_name;
9
9
  _ref1 = input_name.split(" ");
10
10
  first_name = _ref1[0];
11
11
  last_name = _ref1[1];
12
12
  return [first_name,last_name];
13
- }
13
+ };
14
14
 
15
- function test_method() {
15
+ test_method = function() {
16
16
  return console.log("Hello, Adhithya");
17
- }
17
+ };
18
18
 
19
19
  parsed_name = parse_name("Adhithya Rajasekaran");
20
20
 
@@ -0,0 +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
+
9
+ }).call(this);
@@ -11,7 +11,7 @@
11
11
  line = "My favorite language is Ruby!";
12
12
 
13
13
  if (line = line.match(/Ruby|Python/)) {
14
- console.log("Scripting language mentioned: " + line);
14
+ console.log("Scripting language mentioned: " + (line));
15
15
  }
16
16
 
17
17
  }).call(this);
@@ -1,7 +1,7 @@
1
1
  //Written using Nila. Visit http://adhithyan15.github.io/nila
2
2
  (function() {
3
3
  if (visitor_present) {
4
- //This file is for demonstration purpose. It doesn't really achieve anything
4
+ //This file is for demonstration purpose. It doesn't really achieve anything
5
5
  if (active || happy) {
6
6
  console.log("Hello Wonderful Visitor!");
7
7
  } else if (idle && not_engaged) {
@@ -1,8 +1,10 @@
1
1
  //Written using Nila. Visit http://adhithyan15.github.io/nila
2
2
  (function() {
3
- function subtract(num1,num2) {
3
+ var subtract;
4
+
5
+ subtract = function(num1,num2) {
4
6
  return num1-num2;
5
- }
7
+ };
6
8
 
7
9
  console.log(subtract(7,8));
8
10
 
@@ -1,8 +1,10 @@
1
1
  //Written using Nila. Visit http://adhithyan15.github.io/nila
2
2
  (function() {
3
- function subtract(num1,num2) {
3
+ var subtract;
4
+
5
+ subtract = function(num1,num2) {
4
6
  return num1-num2;
5
- }
7
+ };
6
8
 
7
9
  console.log(subtract(7,8));
8
10
 
@@ -4,11 +4,11 @@
4
4
 
5
5
  //This file tests the limits of the string interpolation feature present in Nila
6
6
 
7
- msg = "Hello " + "world. A lovely place." + "" + "Another " + "Lovely quote";
7
+ msg = "Hello " + ("world. A lovely place.") + "" + "Another " + ("Lovely quote");
8
8
 
9
9
  console.log(msg);
10
10
 
11
- console.log("Hello " + "world");
11
+ console.log("Hello " + ("world"));
12
12
 
13
13
  console.log('Hello #{world}');
14
14
 
@@ -0,0 +1,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
+
9
+ (function(n) {
10
+
11
+ console.log("The number is " + (a+n) + "");
12
+
13
+ }(_i));
14
+
15
+ }
16
+
17
+ for (_i = 0, _j = 10; _i < _j; _i += 1) {
18
+
19
+ console.log("Hello");
20
+
21
+ }
22
+
23
+ }).call(this);
@@ -19,7 +19,7 @@
19
19
  i=1;
20
20
 
21
21
  while (!(i > 10)) {
22
- process.stdout.write("" + i + " ");
22
+ process.stdout.write("" + (i) + " ");
23
23
  i+=1;
24
24
  if (i === 9) {
25
25
  break;
@@ -1,12 +1,14 @@
1
1
  //Written using Nila. Visit http://adhithyan15.github.io/nila
2
2
  (function() {
3
- function square(input_number) {
3
+ var return_number, square;
4
+
5
+ square = function(input_number) {
4
6
  return input_number*input_number;
5
- }
7
+ };
6
8
 
7
- function return_number(input_number) {
9
+ return_number = function(input_number) {
8
10
  return input_number;
9
- }
11
+ };
10
12
 
11
13
  console.log(message);
12
14
 
@@ -1,5 +1,7 @@
1
1
  # This file demonstrates several Hash features in Nila
2
2
 
3
+ variable = 5
4
+
3
5
  inst_section = {
4
6
  'cello' => 'string',
5
7
  'clarinet' => 'woodwind',
@@ -0,0 +1 @@
1
+ date = if friday then sue else jill end
@@ -0,0 +1,3 @@
1
+ million = 1_000_000 + 7_000_000
2
+
3
+ puts million
@@ -1,17 +1,17 @@
1
1
  //Written using Nila. Visit http://adhithyan15.github.io/nila
2
2
  (function() {
3
- var goal_reached, hello, message, msg;
3
+ var goal_reached, hello, message, msg, square;
4
4
 
5
5
  hello = "world";
6
6
 
7
7
  msg = "nila";
8
8
 
9
- message = "Welcome to " + msg;
9
+ message = "Welcome to " + (msg);
10
10
 
11
11
  goal_reached = 72;
12
12
 
13
- function square(inputnumber) {
13
+ square = function(inputnumber) {
14
14
  return inputnumber*inputnumber;
15
- }
15
+ };
16
16
 
17
17
  }).call(this);
@@ -0,0 +1,5 @@
1
+ a = 5
2
+
3
+ 10.times { |n| puts "The number is #{a+n}" }
4
+
5
+ 10.times {puts "Hello"}
data/src/nilac.rb CHANGED
@@ -385,19 +385,19 @@ def compile(input_file_path, *output_file_name)
385
385
 
386
386
  if string_split[1].eql?("\"\n")
387
387
 
388
- replacement_string = "\" + " + interpol[2...-1]
388
+ replacement_string = "\" + " + "(#{interpol[2...-1]})"
389
389
 
390
390
  modified_file_contents[index] = modified_file_contents[index].sub(interpol+"\"", replacement_string)
391
391
 
392
392
  elsif string_split[1].eql?("\")\n")
393
393
 
394
- replacement_string = "\" + " + interpol[2...-1]
394
+ replacement_string = "\" + " + "(#{interpol[2...-1]})"
395
395
 
396
- modified_file_contents[index] = modified_file_contents[index].sub(interpol+"\"", replacement_string)
396
+ modified_file_contents[index] = modified_file_contents[index].sub(interpol + "\"", replacement_string)
397
397
 
398
398
  else
399
399
 
400
- replacement_string = "\" + " + interpol[2...-1] + " + \""
400
+ replacement_string = "\"" + " + " + "(#{interpol[2...-1]})" + " + \""
401
401
 
402
402
  modified_file_contents[index] = modified_file_contents[index].sub(interpol, replacement_string)
403
403
 
@@ -684,7 +684,7 @@ def compile(input_file_path, *output_file_name)
684
684
 
685
685
  replacement_parameters << param.lstrip.rstrip
686
686
 
687
- replacement_string = replacement_string + "\n" + "if (#{param.lstrip.rstrip} == null) {\n #{paramvalue.lstrip.rstrip}\n}\n" +"\n"
687
+ replacement_string = replacement_string + "\n" + "if (#{param.lstrip.rstrip} equequ null) {\n #{paramvalue.lstrip.rstrip}\n}\n" +"\n"
688
688
 
689
689
  end
690
690
 
@@ -732,7 +732,7 @@ def compile(input_file_path, *output_file_name)
732
732
 
733
733
  end
734
734
 
735
- def get_variables(input_file_contents, temporary_nila_file)
735
+ def get_variables(input_file_contents, temporary_nila_file, *loop_variables)
736
736
 
737
737
  variables = []
738
738
 
@@ -752,11 +752,13 @@ def compile(input_file_path, *output_file_name)
752
752
 
753
753
  input_file_contents = input_file_contents.collect { |element| element.gsub("=~", "matchequal") }
754
754
 
755
+ javascript_regexp = /(if |while |for )/
756
+
755
757
  for x in 0...input_file_contents.length
756
758
 
757
759
  current_row = input_file_contents[x]
758
760
 
759
- if current_row.include?("=") and !current_row.include?("def")
761
+ if current_row.include?("=") and current_row.index(javascript_regexp) == nil
760
762
 
761
763
  current_row = current_row.rstrip + "\n"
762
764
 
@@ -794,6 +796,10 @@ def compile(input_file_path, *output_file_name)
794
796
 
795
797
  line_by_line_contents = read_file_line_by_line(temporary_nila_file)
796
798
 
799
+ variables += loop_variables
800
+
801
+ variables = variables.flatten
802
+
797
803
  if variables.length > 0
798
804
 
799
805
  variable_declaration_string = "var " + variables.uniq.sort.join(", ") + "\n\n"
@@ -1144,10 +1150,14 @@ def compile(input_file_path, *output_file_name)
1144
1150
 
1145
1151
  def compile_multiline_hashes(input_file_contents,temporary_nila_file)
1146
1152
 
1153
+ javascript_regexp = /(if |while |for |function |function\()/
1154
+
1147
1155
  possible_hashes = input_file_contents.reject { |element| !element.include?("{") }
1148
1156
 
1149
1157
  possible_multiline_hashes = possible_hashes.reject { |element| element.include?("}") }
1150
1158
 
1159
+ possible_multiline_hashes = possible_multiline_hashes.reject {|element| element.index(javascript_regexp) != nil}
1160
+
1151
1161
  multiline_hashes = []
1152
1162
 
1153
1163
  possible_multiline_hashes.each do |starting_line|
@@ -1156,7 +1166,7 @@ def compile(input_file_path, *output_file_name)
1156
1166
 
1157
1167
  line = starting_line
1158
1168
 
1159
- until line.include?("}")
1169
+ until line.include?("}\n")
1160
1170
 
1161
1171
  index += 1
1162
1172
 
@@ -1198,12 +1208,48 @@ def compile(input_file_path, *output_file_name)
1198
1208
 
1199
1209
  def compile_inline_hashes(input_file_contents)
1200
1210
 
1201
- modified_file_contents = input_file_contents.clone.collect {|element| element.gsub(/(#|%)\w?\{/,"innerrii0opol115")}
1211
+ def replace_strings(input_string)
1212
+
1213
+ string_counter = 0
1214
+
1215
+ while input_string.include?("\"")
1216
+
1217
+ string_extract = input_string[input_string.index("\"")..input_string.index("\"",input_string.index("\"")+1)]
1218
+
1219
+ input_string = input_string.sub(string_extract,"--repstring#{string_counter}")
1220
+
1221
+ string_counter += 1
1222
+
1223
+ end
1224
+
1225
+ while input_string.include?("'")
1226
+
1227
+ string_extract = input_string[input_string.index("'")..input_string.index("'",input_string.index("'")+1)]
1228
+
1229
+ input_string = input_string.sub(string_extract,"--repstring#{string_counter}")
1230
+
1231
+ string_counter += 1
1202
1232
 
1203
- possible_inline_hashes = modified_file_contents.reject {|element| !element.include?("{")}
1233
+ end
1234
+
1235
+ return input_string
1236
+
1237
+ end
1238
+
1239
+ javascript_regexp = /(if |while |for |function |function\(|%[qQ]*\{)/
1240
+
1241
+ modified_file_contents = input_file_contents.clone.collect {|element| replace_strings(element)}
1242
+
1243
+ possible_inline_hashes = modified_file_contents.reject {|element| element.count("{") != 1}
1244
+
1245
+ possible_inline_hashes = possible_inline_hashes.reject {|element| element.count("}") != 1}
1246
+
1247
+ possible_inline_hashes = possible_inline_hashes.reject {|element| element.index(javascript_regexp) != nil}
1204
1248
 
1205
1249
  possible_inline_hashes.each do |hash|
1206
1250
 
1251
+ hash = input_file_contents[modified_file_contents.index(hash)]
1252
+
1207
1253
  hash_extract = hash[hash.index("{")..hash.index("}")]
1208
1254
 
1209
1255
  contents = hash_extract[1...-1].split(",")
@@ -1388,6 +1434,30 @@ def compile(input_file_path, *output_file_name)
1388
1434
 
1389
1435
  end
1390
1436
 
1437
+ def compile_integers(input_file_contents)
1438
+
1439
+ modified_file_contents = input_file_contents.clone
1440
+
1441
+ input_file_contents.each_with_index do |line,index|
1442
+
1443
+ matches = line.scan(/(([0-9]+_)+([0-9]+|$))/)
1444
+
1445
+ unless matches.empty?
1446
+
1447
+ matches.each do |match_arr|
1448
+
1449
+ modified_file_contents[index] = modified_file_contents[index].sub(match_arr[0],match_arr[0].gsub("_",""))
1450
+
1451
+ end
1452
+
1453
+ end
1454
+
1455
+ end
1456
+
1457
+ return modified_file_contents
1458
+
1459
+ end
1460
+
1391
1461
  def compile_named_functions(input_file_contents, named_code_blocks, nested_functions, temporary_nila_file)
1392
1462
 
1393
1463
  #This method compiles all the named Nila functions. Below is an example of what is meant
@@ -1401,11 +1471,11 @@ def compile(input_file_path, *output_file_name)
1401
1471
 
1402
1472
  #The above function will compile to
1403
1473
 
1404
- #function square(input_number) {
1474
+ #square = function(input_number) {
1405
1475
  #
1406
1476
  # return input_number*input_number;
1407
1477
  #
1408
- #}
1478
+ #};
1409
1479
 
1410
1480
  def is_parameterless?(input_function_block)
1411
1481
 
@@ -1656,6 +1726,16 @@ def compile(input_file_path, *output_file_name)
1656
1726
 
1657
1727
  end
1658
1728
 
1729
+ def coffee_type_function(input_array)
1730
+
1731
+ function_name = input_array[0].split("function ")[1].split("(")[0].lstrip
1732
+
1733
+ input_array[0] = "#{function_name} = function(" + input_array[0].split("function ")[1].split("(")[1].lstrip
1734
+
1735
+ return input_array
1736
+
1737
+ end
1738
+
1659
1739
  def compile_function(input_array, temporary_nila_file)
1660
1740
 
1661
1741
  modified_input_array = input_array.dup
@@ -1716,7 +1796,7 @@ def compile(input_file_path, *output_file_name)
1716
1796
 
1717
1797
  end
1718
1798
 
1719
- modified_input_array[-1] = input_array[-1].sub "end", "}\n"
1799
+ modified_input_array[-1] = input_array[-1].sub "end", "};\n"
1720
1800
 
1721
1801
  modified_input_array = compile_parallel_assignment(modified_input_array, temporary_nila_file)
1722
1802
 
@@ -1736,6 +1816,8 @@ def compile(input_file_path, *output_file_name)
1736
1816
 
1737
1817
  modified_input_array = compile_multiple_return(modified_input_array)
1738
1818
 
1819
+ modified_input_array = coffee_type_function(modified_input_array)
1820
+
1739
1821
  return modified_input_array
1740
1822
 
1741
1823
  end
@@ -1873,7 +1955,13 @@ def compile(input_file_path, *output_file_name)
1873
1955
 
1874
1956
  extracted_string = input_string[location..-1]
1875
1957
 
1876
- pattern << extracted_string[0..extracted_string.index(pattern_end)]
1958
+ string_extract = extracted_string[0..extracted_string.index(pattern_end)]
1959
+
1960
+ if !string_extract.include?(" = function(")
1961
+
1962
+ pattern << string_extract
1963
+
1964
+ end
1877
1965
 
1878
1966
  end
1879
1967
 
@@ -2979,6 +3067,110 @@ def compile(input_file_path, *output_file_name)
2979
3067
 
2980
3068
  end
2981
3069
 
3070
+ def compile_loops(input_file_contents,temporary_nila_file)
3071
+
3072
+ def compile_times_loop(input_file_contents,temporary_nila_file)
3073
+
3074
+ def compile_one_line_blocks(input_block)
3075
+
3076
+ block_parameters, block_contents = input_block[1...-1].split("|",2)[1].split("|",2)
3077
+
3078
+ compiled_block = "(function(#{block_parameters.lstrip.rstrip}) {\n\n #{block_contents} \n\n}(_i))_!;\n"
3079
+
3080
+ return compiled_block
3081
+
3082
+ end
3083
+
3084
+ modified_file_contents = input_file_contents.clone
3085
+
3086
+ possible_times_loop = input_file_contents.reject{ |element| !element.include?(".times")}
3087
+
3088
+ oneliner_times_loop = possible_times_loop.reject {|element| !element.include?("{") and !element.include?("}")}
3089
+
3090
+ #multiline_times_loop = possible_times_loop-oneliner_times_loop
3091
+
3092
+ #multiline_times_loop = multiline_times_loop.reject {|element| !element.include?(" do ")}
3093
+
3094
+ loop_variables = []
3095
+
3096
+ unless oneliner_times_loop.empty?
3097
+
3098
+ oneliner_times_loop.each do |loop|
3099
+
3100
+ original_loop = loop.clone
3101
+
3102
+ string_counter = 1
3103
+
3104
+ extracted_string = []
3105
+
3106
+ while loop.include?("\"")
3107
+
3108
+ string_extract = loop[loop.index("\"")..loop.index("\"",loop.index("\"")+1)]
3109
+
3110
+ extracted_string << string_extract
3111
+
3112
+ loop = loop.sub(string_extract,"--repstring#{string_counter}")
3113
+
3114
+ string_counter += 1
3115
+
3116
+ end
3117
+
3118
+ block_extract = loop[loop.index("{")..loop.index("}")]
3119
+
3120
+ compiled_block = ""
3121
+
3122
+ if block_extract.count("|") == 2
3123
+
3124
+ compiled_block = compile_one_line_blocks(block_extract)
3125
+
3126
+ extracted_string.each_with_index do |string,index|
3127
+
3128
+ compiled_block = compiled_block.sub("--repstring#{index+1}",string)
3129
+
3130
+ end
3131
+
3132
+ else
3133
+
3134
+ compiled_block = block_extract[1...-1].lstrip.rstrip
3135
+
3136
+ extracted_string.each_with_index do |string,index|
3137
+
3138
+ compiled_block = compiled_block.sub("--repstring#{index+1}",string)
3139
+
3140
+ end
3141
+
3142
+ end
3143
+
3144
+ times_counter = loop.split(".times")[0].lstrip
3145
+
3146
+ replacement_string = "for (_i = 0, _j = #{times_counter}; _i < _j; _i += 1) {\n\n#{compiled_block}\n\n}"
3147
+
3148
+ modified_file_contents[input_file_contents.index(original_loop)] = replacement_string
3149
+
3150
+ end
3151
+
3152
+ loop_variables = ["_i","_j"]
3153
+
3154
+ end
3155
+
3156
+ file_id = open(temporary_nila_file, 'w')
3157
+
3158
+ file_id.write(modified_file_contents.join)
3159
+
3160
+ file_id.close()
3161
+
3162
+ line_by_line_contents = read_file_line_by_line(temporary_nila_file)
3163
+
3164
+ return line_by_line_contents,loop_variables
3165
+
3166
+ end
3167
+
3168
+ file_contents,loop_variables = compile_times_loop(input_file_contents,temporary_nila_file)
3169
+
3170
+ return file_contents,loop_variables
3171
+
3172
+ end
3173
+
2982
3174
  def add_semicolons(input_file_contents)
2983
3175
 
2984
3176
  def comment(input_string)
@@ -3280,7 +3472,7 @@ def compile(input_file_path, *output_file_name)
3280
3472
 
3281
3473
  if !code_block_starting_locations.empty?
3282
3474
 
3283
- controlregexp = /(if |while |function |function\(|((=|:)\s+\{))/
3475
+ controlregexp = /(if |for |while |\(function\(|= function\(|((=|:)\s+\{))/
3284
3476
 
3285
3477
  code_block_starting_locations = [0, code_block_starting_locations, -1].flatten
3286
3478
 
@@ -3294,6 +3486,12 @@ def compile(input_file_path, *output_file_name)
3294
3486
 
3295
3487
  possible_blocks << input_file_contents[code_block_starting_locations[x]..code_block_starting_locations[x+1]]
3296
3488
 
3489
+ if possible_blocks.length > 1
3490
+
3491
+ possible_blocks[-1] = possible_blocks[-1][1..-1]
3492
+
3493
+ end
3494
+
3297
3495
  end
3298
3496
 
3299
3497
  end_counter = 0
@@ -3304,11 +3502,19 @@ def compile(input_file_path, *output_file_name)
3304
3502
 
3305
3503
  possible_blocks.each_with_index do |block|
3306
3504
 
3307
- current_block += block
3505
+ if !block[0].eql?(current_block[-1])
3506
+
3507
+ current_block += block
3508
+
3509
+ else
3510
+
3511
+ current_block += block[1..-1]
3512
+
3513
+ end
3308
3514
 
3309
3515
  current_block.each_with_index do |line, index|
3310
3516
 
3311
- if line.lstrip.eql? "}\n" or line.lstrip.eql?("};\n")
3517
+ if line.lstrip.eql? "}\n" or line.lstrip.eql?("};\n") or line.lstrip.include?("_!;\n")
3312
3518
 
3313
3519
  end_counter += 1
3314
3520
 
@@ -3352,7 +3558,7 @@ def compile(input_file_path, *output_file_name)
3352
3558
 
3353
3559
  current_block.each_with_index do |line, index|
3354
3560
 
3355
- if line.lstrip.eql? "}\n"
3561
+ if line.lstrip.eql? "}\n" or line.lstrip.eql?("};\n") or line.lstrip.include?("_!;\n")
3356
3562
 
3357
3563
  end_counter += 1
3358
3564
 
@@ -3410,7 +3616,7 @@ def compile(input_file_path, *output_file_name)
3410
3616
 
3411
3617
  end
3412
3618
 
3413
- javascript_regexp = /(if |while |function |function\(|((=|:)\s+\{))/
3619
+ javascript_regexp = /(if |for |while |\(function\(|= function\(|((=|:)\s+\{))/
3414
3620
 
3415
3621
  javascript_file_contents = javascript_file_contents.collect { |element| element.sub("Euuf", "if") }
3416
3622
 
@@ -3624,12 +3830,16 @@ def compile(input_file_path, *output_file_name)
3624
3830
 
3625
3831
  input_file_contents = input_file_contents.collect { |element| element.sub("!=", "!==") }
3626
3832
 
3833
+ input_file_contents = input_file_contents.collect { |element| element.sub("equequ", "==") }
3834
+
3627
3835
  input_file_contents = input_file_contents.collect { |element| element.sub("elsuf", "else if") }
3628
3836
 
3629
3837
  input_file_contents = input_file_contents.collect { |element| compile_power_operator(element) }
3630
3838
 
3631
3839
  input_file_contents = input_file_contents.collect {|element| compile_match_operator(element)}
3632
3840
 
3841
+ input_file_contents = input_file_contents.collect {|element| element.gsub("_!;",";")}
3842
+
3633
3843
  return input_file_contents
3634
3844
 
3635
3845
  end
@@ -3667,6 +3877,8 @@ def compile(input_file_path, *output_file_name)
3667
3877
 
3668
3878
  file_contents = compile_heredocs(file_contents, temp_file)
3669
3879
 
3880
+ file_contents,loop_vars = compile_loops(file_contents,temp_file)
3881
+
3670
3882
  file_contents = compile_interpolated_strings(file_contents)
3671
3883
 
3672
3884
  file_contents = compile_hashes(file_contents,temp_file)
@@ -3677,6 +3889,8 @@ def compile(input_file_path, *output_file_name)
3677
3889
 
3678
3890
  file_contents = compile_strings(file_contents)
3679
3891
 
3892
+ file_contents = compile_integers(file_contents)
3893
+
3680
3894
  file_contents = compile_default_values(file_contents, temp_file)
3681
3895
 
3682
3896
  file_contents, named_functions, nested_functions = replace_named_functions(file_contents, temp_file)
@@ -3685,14 +3899,16 @@ def compile(input_file_path, *output_file_name)
3685
3899
 
3686
3900
  file_contents = compile_parallel_assignment(file_contents, temp_file)
3687
3901
 
3688
- list_of_variables, file_contents = get_variables(file_contents, temp_file)
3689
-
3690
3902
  file_contents, function_names = compile_named_functions(file_contents, named_functions, nested_functions, temp_file)
3691
3903
 
3904
+ list_of_variables, file_contents = get_variables(file_contents, temp_file,loop_vars)
3905
+
3692
3906
  file_contents, ruby_functions = compile_custom_function_map(file_contents)
3693
3907
 
3694
3908
  function_names << ruby_functions
3695
3909
 
3910
+ list_of_variables += loop_vars
3911
+
3696
3912
  file_contents = compile_whitespace_delimited_functions(file_contents, function_names, temp_file)
3697
3913
 
3698
3914
  file_contents = remove_question_marks(file_contents, list_of_variables, temp_file)
@@ -3771,7 +3987,7 @@ def find_file_path(input_path, file_extension)
3771
3987
 
3772
3988
  end
3773
3989
 
3774
- nilac_version = "0.0.4.2.6"
3990
+ nilac_version = "0.0.4.2.8"
3775
3991
 
3776
3992
  opts = Slop.parse do
3777
3993
  on :c, :compile=, 'Compile Nila File', as:Array, delimiter:":"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nilac
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4.2.6
4
+ version: 0.0.4.2.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-10 00:00:00.000000000 Z
12
+ date: 2013-08-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: shark
@@ -67,15 +67,18 @@ files:
67
67
  - shark/features/fix_newlines.feature
68
68
  - shark/features/hashes.feature
69
69
  - shark/features/heredoc.feature
70
+ - shark/features/if_then_else.feature
70
71
  - shark/features/loop.feature
71
72
  - shark/features/method_multiple_return.feature
72
73
  - shark/features/multiline_array.feature
73
74
  - shark/features/multiple_variable_initialization.feature
75
+ - shark/features/numbers.feature
74
76
  - shark/features/regular_if.feature
75
77
  - shark/features/regular_while.feature
76
78
  - shark/features/ruby_operators.feature
77
79
  - shark/features/string_interpolation.feature
78
80
  - shark/features/strings.feature
81
+ - shark/features/times.feature
79
82
  - shark/features/unless_until.feature
80
83
  - shark/features/whitespace_delimitation.feature
81
84
  - shark/test_files/array_string_indexing.nila
@@ -83,11 +86,13 @@ files:
83
86
  - shark/test_files/correct_default_parameters.js
84
87
  - shark/test_files/correct_hashes.js
85
88
  - shark/test_files/correct_heredoc.js
89
+ - shark/test_files/correct_if_then_else.js
86
90
  - shark/test_files/correct_indexing.js
87
91
  - shark/test_files/correct_initialization.js
88
92
  - shark/test_files/correct_loop.js
89
93
  - shark/test_files/correct_multiline_array.js
90
94
  - shark/test_files/correct_multiple_return.js
95
+ - shark/test_files/correct_numbers.js
91
96
  - shark/test_files/correct_operators.js
92
97
  - shark/test_files/correct_regular_if.js
93
98
  - shark/test_files/correct_regular_while.js
@@ -95,17 +100,20 @@ files:
95
100
  - shark/test_files/correct_single_return.js
96
101
  - shark/test_files/correct_string_interpolation.js
97
102
  - shark/test_files/correct_string_operators.js
103
+ - shark/test_files/correct_times.js
98
104
  - shark/test_files/correct_unless_until.js
99
105
  - shark/test_files/correct_whitespace_delimiter.js
100
106
  - shark/test_files/default_parameters.nila
101
107
  - shark/test_files/erratic.nila
102
108
  - shark/test_files/hashes.nila
103
109
  - shark/test_files/heredoc.nila
110
+ - shark/test_files/if_then_else.nila
104
111
  - shark/test_files/loop.nila
105
112
  - shark/test_files/multiline_array.nila
106
113
  - shark/test_files/multiple_initialization.nila
107
114
  - shark/test_files/multiple_return.nila
108
115
  - shark/test_files/no_return.nila
116
+ - shark/test_files/numbers.nila
109
117
  - shark/test_files/operators.nila
110
118
  - shark/test_files/perfect.js
111
119
  - shark/test_files/regular_if.nila
@@ -114,6 +122,7 @@ files:
114
122
  - shark/test_files/single_return.nila
115
123
  - shark/test_files/string_interpolation.nila
116
124
  - shark/test_files/string_operators.nila
125
+ - shark/test_files/times.nila
117
126
  - shark/test_files/unless_until.nila
118
127
  - shark/test_files/whitespace_delimiter.nila
119
128
  - src/nilac.rb