nilac 0.0.4.1.4 → 0.0.4.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/bin/nilac CHANGED
@@ -696,7 +696,6 @@ def compile(input_file_path,*output_file_name)
696
696
  #Currently the following kinds of array constructs are compilable
697
697
 
698
698
  # 1. %w{} syntax
699
- # 2. Range - Coming soon!
700
699
 
701
700
  def compile_w_arrays(input_file_contents)
702
701
 
@@ -895,6 +894,98 @@ def compile(input_file_path,*output_file_name)
895
894
 
896
895
  end
897
896
 
897
+ def compile_strings(input_file_contents)
898
+
899
+ # This method will compile %q, %Q and %{} syntax. Heredocs support will be added in the future
900
+
901
+ def compile_small_q_syntax(input_file_contents)
902
+
903
+ possible_syntax_usage = input_file_contents.reject {|element| !element.include?("%q")}
904
+
905
+ possible_syntax_usage.each do |line|
906
+
907
+ modified_line = line.dup
908
+
909
+ line_split = line.split("+").collect {|element| element.lstrip.rstrip}
910
+
911
+ line_split.each do |str|
912
+
913
+ delimiter = str[str.index("%q")+2]
914
+
915
+ string_extract = str[str.index("%q")..-1]
916
+
917
+ delimiter = "}" if delimiter.eql?("{")
918
+
919
+ if string_extract[-1].eql?(delimiter)
920
+
921
+ input_file_contents[input_file_contents.index(modified_line)] = input_file_contents[input_file_contents.index(modified_line)].sub(string_extract,"'#{string_extract[3...-1]}'")
922
+
923
+ modified_line = modified_line.sub(string_extract,"'#{string_extract[3...-1]}'")
924
+
925
+ elsif delimiter.eql?(" ")
926
+
927
+ input_file_contents[input_file_contents.index(modified_line)] = input_file_contents[input_file_contents.index(modified_line)].sub(string_extract,"'#{string_extract[3..-1]}'")
928
+
929
+ modified_line = modified_line.sub(string_extract,"'#{string_extract[3..-1]}'")
930
+
931
+ end
932
+
933
+ end
934
+
935
+ end
936
+
937
+ return input_file_contents
938
+
939
+ end
940
+
941
+ def compile_big_q_syntax(input_file_contents)
942
+
943
+ possible_syntax_usage = input_file_contents.reject {|element| !element.include?("%Q")}
944
+
945
+ possible_syntax_usage.each do |line|
946
+
947
+ modified_line = line.dup
948
+
949
+ line_split = line.split("+").collect {|element| element.lstrip.rstrip}
950
+
951
+ line_split.each do |str|
952
+
953
+ delimiter = str[str.index("%Q")+2]
954
+
955
+ string_extract = str[str.index("%Q")..-1]
956
+
957
+ delimiter = "}" if delimiter.eql?("{")
958
+
959
+ if string_extract[-1].eql?(delimiter)
960
+
961
+ input_file_contents[input_file_contents.index(modified_line)] = input_file_contents[input_file_contents.index(modified_line)].sub(string_extract,"\"#{string_extract[3...-1]}\"")
962
+
963
+ modified_line = modified_line.sub(string_extract,"\"#{string_extract[3...-1]}\"")
964
+
965
+ elsif delimiter.eql?(" ")
966
+
967
+ input_file_contents[input_file_contents.index(modified_line)] = input_file_contents[input_file_contents.index(modified_line)].sub(string_extract,"\"#{string_extract[3..-1]}\"")
968
+
969
+ modified_line = modified_line.sub(string_extract,"\"#{string_extract[3..-1]}\"")
970
+
971
+ end
972
+
973
+ end
974
+
975
+ end
976
+
977
+ return input_file_contents
978
+
979
+ end
980
+
981
+ file_contents = compile_small_q_syntax(input_file_contents)
982
+
983
+ file_contents = compile_big_q_syntax(input_file_contents)
984
+
985
+ return file_contents
986
+
987
+ end
988
+
898
989
  def compile_named_functions(input_file_contents,named_code_blocks,nested_functions,temporary_nila_file)
899
990
 
900
991
  #This method compiles all the named Nila functions. Below is an example of what is meant
@@ -1324,8 +1415,6 @@ def compile(input_file_path,*output_file_name)
1324
1415
  "p" => "console.log",
1325
1416
 
1326
1417
  "print" => "process.stdout.write"
1327
-
1328
-
1329
1418
  }
1330
1419
 
1331
1420
  function_map = function_map_replacements.keys
@@ -1936,12 +2025,12 @@ def compile(input_file_path,*output_file_name)
1936
2025
 
1937
2026
  def compile_while_syntax(input_block)
1938
2027
 
2028
+ modified_input_block = input_block.dup
2029
+
1939
2030
  strings = []
1940
2031
 
1941
2032
  string_counter = 0
1942
2033
 
1943
- modified_input_block = input_block.dup
1944
-
1945
2034
  input_block.each_with_index do |line,index|
1946
2035
 
1947
2036
  if line.include?("\"")
@@ -2056,7 +2145,7 @@ def compile(input_file_path,*output_file_name)
2056
2145
 
2057
2146
  else
2058
2147
 
2059
- joined_file_contents = joined_file_contents.sub(rejected_elements_index[0],rejected_elements[0])
2148
+ joined_file_contents = joined_file_contents.sub(rejected_elements_index[0],rejected_elements[0].join)
2060
2149
 
2061
2150
  rejected_elements_index.delete_at(0)
2062
2151
 
@@ -2066,7 +2155,7 @@ def compile(input_file_path,*output_file_name)
2066
2155
 
2067
2156
  else
2068
2157
 
2069
- joined_file_contents = joined_file_contents.sub(rejected_elements_index[0],rejected_elements[0])
2158
+ joined_file_contents = joined_file_contents.sub(rejected_elements_index[0],rejected_elements[0].join)
2070
2159
 
2071
2160
  rejected_elements_index.delete_at(0)
2072
2161
 
@@ -2094,12 +2183,84 @@ def compile(input_file_path,*output_file_name)
2094
2183
 
2095
2184
  end
2096
2185
 
2097
- file_contents = replace_unless_until(input_file_contents)
2186
+ def ignore_statement_modifiers(input_block)
2187
+
2188
+ modified_input_block = input_block.dup
2189
+
2190
+ rejectionregexp = /( if | while )/
2191
+
2192
+ rejected_lines = {}
2193
+
2194
+ rejected_line_counter = 0
2195
+
2196
+ input_block.each_with_index do |line,index|
2197
+
2198
+ if line.lstrip.index(rejectionregexp) != nil
2199
+
2200
+ rejected_lines["--rejected{#{rejected_line_counter}}\n\n"] = line
2201
+
2202
+ modified_input_block[index] = "--rejected{#{rejected_line_counter}}\n\n"
2203
+
2204
+ rejected_line_counter += 1
2205
+
2206
+ end
2207
+
2208
+ end
2209
+
2210
+ return modified_input_block,rejected_lines
2211
+
2212
+ end
2213
+
2214
+ def replace_statement_modifiers(input_block,rejected_lines)
2215
+
2216
+ unless rejected_lines.empty?
2217
+
2218
+ rejected_replacements = rejected_lines.keys
2219
+
2220
+ loc = 0
2221
+
2222
+ indices = []
2223
+
2224
+ index_counter = 0
2225
+
2226
+ rejected_replacements.each do |replacement_string|
2227
+
2228
+ input_block.each_with_index do |line,index|
2229
+
2230
+ break if line.include?(replacement_string.rstrip)
2231
+
2232
+ index_counter += 1
2233
+
2234
+ end
2235
+
2236
+ indices << index_counter
2237
+
2238
+ index_counter = 0
2239
+
2240
+ end
2241
+
2242
+ indices.each_with_index do |location,index|
2243
+
2244
+ input_block[location] = rejected_lines.values[index] + "\n\n"
2245
+
2246
+ end
2247
+
2248
+ end
2249
+
2250
+ return input_block
2251
+
2252
+ end
2253
+
2254
+ file_contents,rejected_lines = ignore_statement_modifiers(input_file_contents)
2255
+
2256
+ file_contents = replace_unless_until(file_contents)
2098
2257
 
2099
2258
  file_contents = compile_regular_if(file_contents,temporary_nila_file)
2100
2259
 
2101
2260
  file_contents = compile_regular_while(file_contents,temporary_nila_file)
2102
2261
 
2262
+ file_contents = replace_statement_modifiers(file_contents,rejected_lines)
2263
+
2103
2264
  file_contents = compile_inline_conditionals(file_contents,temporary_nila_file)
2104
2265
 
2105
2266
  return file_contents
@@ -2258,7 +2419,7 @@ def compile(input_file_path,*output_file_name)
2258
2419
 
2259
2420
  end
2260
2421
 
2261
- def pretty_print_javascript(javascript_file_contents,temporary_nila_file,comments)
2422
+ def pretty_print_javascript(javascript_file_contents,temporary_nila_file)
2262
2423
 
2263
2424
  def reset_tabs(input_file_contents)
2264
2425
 
@@ -2699,6 +2860,26 @@ def compile(input_file_path,*output_file_name)
2699
2860
 
2700
2861
  def compile_operators(input_file_contents)
2701
2862
 
2863
+ def compile_power_operator(input_string)
2864
+
2865
+ matches = input_string.scan(/(\w{1,}\*\*\w{1,})/).to_a.flatten
2866
+
2867
+ unless matches.empty?
2868
+
2869
+ matches.each do |match|
2870
+
2871
+ left,right = match.split("**")
2872
+
2873
+ input_string = input_string.sub(match,"Math.pow(#{left},#{right})")
2874
+
2875
+ end
2876
+
2877
+ end
2878
+
2879
+ return input_string
2880
+
2881
+ end
2882
+
2702
2883
  input_file_contents = input_file_contents.collect {|element| element.sub(" and "," && ")}
2703
2884
 
2704
2885
  input_file_contents = input_file_contents.collect {|element| element.sub(" or "," || ")}
@@ -2709,13 +2890,15 @@ def compile(input_file_path,*output_file_name)
2709
2890
 
2710
2891
  input_file_contents = input_file_contents.collect {|element| element.sub("elsuf","else if")}
2711
2892
 
2893
+ input_file_contents = input_file_contents.collect {|element| compile_power_operator(element)}
2894
+
2712
2895
  return input_file_contents
2713
2896
 
2714
2897
  end
2715
2898
 
2716
- def pretty_print_nila(input_file_contents)
2899
+ def pretty_print_nila(input_file_contents,temporary_nila_file)
2900
+
2717
2901
 
2718
- #Implementation is pending
2719
2902
 
2720
2903
  end
2721
2904
 
@@ -2751,6 +2934,8 @@ def compile(input_file_path,*output_file_name)
2751
2934
 
2752
2935
  file_contents = compile_arrays(file_contents)
2753
2936
 
2937
+ file_contents = compile_strings(file_contents)
2938
+
2754
2939
  file_contents = compile_default_values(file_contents,temp_file)
2755
2940
 
2756
2941
  file_contents,named_functions,nested_functions = replace_named_functions(file_contents,temp_file)
@@ -2775,7 +2960,7 @@ def compile(input_file_path,*output_file_name)
2775
2960
 
2776
2961
  file_contents = compile_comments(file_contents,comments,temp_file)
2777
2962
 
2778
- file_contents = pretty_print_javascript(file_contents,temp_file,comments)
2963
+ file_contents = pretty_print_javascript(file_contents,temp_file)
2779
2964
 
2780
2965
  file_contents = compile_operators(file_contents)
2781
2966
 
data/lib/nilac/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Nilac
2
- VERSION = "0.0.4.1.4"
2
+ VERSION = "0.0.4.1.5"
3
3
  end
@@ -0,0 +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
11
+ :v $cliusage => ruby :v --compile $file
@@ -0,0 +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
11
+ :v $cliusage => ruby :v --compile $file
@@ -0,0 +1,11 @@
1
+ //Written using Nila. Visit http://adhithyan15.github.io/nila
2
+ (function() {
3
+ var a;
4
+
5
+ a = Math.pow(2,3);
6
+
7
+ if (a === 8) {
8
+ console.log("Correct Calculation!");
9
+ }
10
+
11
+ }).call(this);
@@ -0,0 +1,19 @@
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
+ }).call(this);
@@ -21,7 +21,9 @@
21
21
  while (!(i > 10)) {
22
22
  process.stdout.write("" + i + " ");
23
23
  i+=1;
24
- //redo if i > 10
24
+ if (i === 9) {
25
+ break;
26
+ }
25
27
  }
26
28
 
27
29
  }).call(this);
@@ -0,0 +1,3 @@
1
+ a = 2**3
2
+
3
+ puts "Correct Calculation!" if a == 8
@@ -0,0 +1,13 @@
1
+ # This file demonstrates different ways to declare a string
2
+
3
+ str = %q{this is a wonderful string}
4
+
5
+ str = %q!this is a wonderful string!
6
+
7
+ str = %q this is a wonderful string + %q this is another wonderful string
8
+
9
+ str = %Q{this is a wonderful string}
10
+
11
+ str = %Q!this is a wonderful string!
12
+
13
+ str = %Q this is a wonderful string + %Q this is another wonderful string
@@ -13,5 +13,5 @@ i=1
13
13
  until i > 10
14
14
  print "#{i} "
15
15
  i+=1
16
- #redo if i > 10
16
+ break if i == 9
17
17
  end
data/src/nilac.rb CHANGED
@@ -694,7 +694,6 @@ def compile(input_file_path,*output_file_name)
694
694
  #Currently the following kinds of array constructs are compilable
695
695
 
696
696
  # 1. %w{} syntax
697
- # 2. Range - Coming soon!
698
697
 
699
698
  def compile_w_arrays(input_file_contents)
700
699
 
@@ -893,6 +892,98 @@ def compile(input_file_path,*output_file_name)
893
892
 
894
893
  end
895
894
 
895
+ def compile_strings(input_file_contents)
896
+
897
+ # This method will compile %q, %Q and %{} syntax. Heredocs support will be added in the future
898
+
899
+ def compile_small_q_syntax(input_file_contents)
900
+
901
+ possible_syntax_usage = input_file_contents.reject {|element| !element.include?("%q")}
902
+
903
+ possible_syntax_usage.each do |line|
904
+
905
+ modified_line = line.dup
906
+
907
+ line_split = line.split("+").collect {|element| element.lstrip.rstrip}
908
+
909
+ line_split.each do |str|
910
+
911
+ delimiter = str[str.index("%q")+2]
912
+
913
+ string_extract = str[str.index("%q")..-1]
914
+
915
+ delimiter = "}" if delimiter.eql?("{")
916
+
917
+ if string_extract[-1].eql?(delimiter)
918
+
919
+ input_file_contents[input_file_contents.index(modified_line)] = input_file_contents[input_file_contents.index(modified_line)].sub(string_extract,"'#{string_extract[3...-1]}'")
920
+
921
+ modified_line = modified_line.sub(string_extract,"'#{string_extract[3...-1]}'")
922
+
923
+ elsif delimiter.eql?(" ")
924
+
925
+ input_file_contents[input_file_contents.index(modified_line)] = input_file_contents[input_file_contents.index(modified_line)].sub(string_extract,"'#{string_extract[3..-1]}'")
926
+
927
+ modified_line = modified_line.sub(string_extract,"'#{string_extract[3..-1]}'")
928
+
929
+ end
930
+
931
+ end
932
+
933
+ end
934
+
935
+ return input_file_contents
936
+
937
+ end
938
+
939
+ def compile_big_q_syntax(input_file_contents)
940
+
941
+ possible_syntax_usage = input_file_contents.reject {|element| !element.include?("%Q")}
942
+
943
+ possible_syntax_usage.each do |line|
944
+
945
+ modified_line = line.dup
946
+
947
+ line_split = line.split("+").collect {|element| element.lstrip.rstrip}
948
+
949
+ line_split.each do |str|
950
+
951
+ delimiter = str[str.index("%Q")+2]
952
+
953
+ string_extract = str[str.index("%Q")..-1]
954
+
955
+ delimiter = "}" if delimiter.eql?("{")
956
+
957
+ if string_extract[-1].eql?(delimiter)
958
+
959
+ input_file_contents[input_file_contents.index(modified_line)] = input_file_contents[input_file_contents.index(modified_line)].sub(string_extract,"\"#{string_extract[3...-1]}\"")
960
+
961
+ modified_line = modified_line.sub(string_extract,"\"#{string_extract[3...-1]}\"")
962
+
963
+ elsif delimiter.eql?(" ")
964
+
965
+ input_file_contents[input_file_contents.index(modified_line)] = input_file_contents[input_file_contents.index(modified_line)].sub(string_extract,"\"#{string_extract[3..-1]}\"")
966
+
967
+ modified_line = modified_line.sub(string_extract,"\"#{string_extract[3..-1]}\"")
968
+
969
+ end
970
+
971
+ end
972
+
973
+ end
974
+
975
+ return input_file_contents
976
+
977
+ end
978
+
979
+ file_contents = compile_small_q_syntax(input_file_contents)
980
+
981
+ file_contents = compile_big_q_syntax(input_file_contents)
982
+
983
+ return file_contents
984
+
985
+ end
986
+
896
987
  def compile_named_functions(input_file_contents,named_code_blocks,nested_functions,temporary_nila_file)
897
988
 
898
989
  #This method compiles all the named Nila functions. Below is an example of what is meant
@@ -1322,8 +1413,6 @@ def compile(input_file_path,*output_file_name)
1322
1413
  "p" => "console.log",
1323
1414
 
1324
1415
  "print" => "process.stdout.write"
1325
-
1326
-
1327
1416
  }
1328
1417
 
1329
1418
  function_map = function_map_replacements.keys
@@ -1934,12 +2023,12 @@ def compile(input_file_path,*output_file_name)
1934
2023
 
1935
2024
  def compile_while_syntax(input_block)
1936
2025
 
2026
+ modified_input_block = input_block.dup
2027
+
1937
2028
  strings = []
1938
2029
 
1939
2030
  string_counter = 0
1940
2031
 
1941
- modified_input_block = input_block.dup
1942
-
1943
2032
  input_block.each_with_index do |line,index|
1944
2033
 
1945
2034
  if line.include?("\"")
@@ -2054,7 +2143,7 @@ def compile(input_file_path,*output_file_name)
2054
2143
 
2055
2144
  else
2056
2145
 
2057
- joined_file_contents = joined_file_contents.sub(rejected_elements_index[0],rejected_elements[0])
2146
+ joined_file_contents = joined_file_contents.sub(rejected_elements_index[0],rejected_elements[0].join)
2058
2147
 
2059
2148
  rejected_elements_index.delete_at(0)
2060
2149
 
@@ -2064,7 +2153,7 @@ def compile(input_file_path,*output_file_name)
2064
2153
 
2065
2154
  else
2066
2155
 
2067
- joined_file_contents = joined_file_contents.sub(rejected_elements_index[0],rejected_elements[0])
2156
+ joined_file_contents = joined_file_contents.sub(rejected_elements_index[0],rejected_elements[0].join)
2068
2157
 
2069
2158
  rejected_elements_index.delete_at(0)
2070
2159
 
@@ -2092,12 +2181,84 @@ def compile(input_file_path,*output_file_name)
2092
2181
 
2093
2182
  end
2094
2183
 
2095
- file_contents = replace_unless_until(input_file_contents)
2184
+ def ignore_statement_modifiers(input_block)
2185
+
2186
+ modified_input_block = input_block.dup
2187
+
2188
+ rejectionregexp = /( if | while )/
2189
+
2190
+ rejected_lines = {}
2191
+
2192
+ rejected_line_counter = 0
2193
+
2194
+ input_block.each_with_index do |line,index|
2195
+
2196
+ if line.lstrip.index(rejectionregexp) != nil
2197
+
2198
+ rejected_lines["--rejected{#{rejected_line_counter}}\n\n"] = line
2199
+
2200
+ modified_input_block[index] = "--rejected{#{rejected_line_counter}}\n\n"
2201
+
2202
+ rejected_line_counter += 1
2203
+
2204
+ end
2205
+
2206
+ end
2207
+
2208
+ return modified_input_block,rejected_lines
2209
+
2210
+ end
2211
+
2212
+ def replace_statement_modifiers(input_block,rejected_lines)
2213
+
2214
+ unless rejected_lines.empty?
2215
+
2216
+ rejected_replacements = rejected_lines.keys
2217
+
2218
+ loc = 0
2219
+
2220
+ indices = []
2221
+
2222
+ index_counter = 0
2223
+
2224
+ rejected_replacements.each do |replacement_string|
2225
+
2226
+ input_block.each_with_index do |line,index|
2227
+
2228
+ break if line.include?(replacement_string.rstrip)
2229
+
2230
+ index_counter += 1
2231
+
2232
+ end
2233
+
2234
+ indices << index_counter
2235
+
2236
+ index_counter = 0
2237
+
2238
+ end
2239
+
2240
+ indices.each_with_index do |location,index|
2241
+
2242
+ input_block[location] = rejected_lines.values[index] + "\n\n"
2243
+
2244
+ end
2245
+
2246
+ end
2247
+
2248
+ return input_block
2249
+
2250
+ end
2251
+
2252
+ file_contents,rejected_lines = ignore_statement_modifiers(input_file_contents)
2253
+
2254
+ file_contents = replace_unless_until(file_contents)
2096
2255
 
2097
2256
  file_contents = compile_regular_if(file_contents,temporary_nila_file)
2098
2257
 
2099
2258
  file_contents = compile_regular_while(file_contents,temporary_nila_file)
2100
2259
 
2260
+ file_contents = replace_statement_modifiers(file_contents,rejected_lines)
2261
+
2101
2262
  file_contents = compile_inline_conditionals(file_contents,temporary_nila_file)
2102
2263
 
2103
2264
  return file_contents
@@ -2256,7 +2417,7 @@ def compile(input_file_path,*output_file_name)
2256
2417
 
2257
2418
  end
2258
2419
 
2259
- def pretty_print_javascript(javascript_file_contents,temporary_nila_file,comments)
2420
+ def pretty_print_javascript(javascript_file_contents,temporary_nila_file)
2260
2421
 
2261
2422
  def reset_tabs(input_file_contents)
2262
2423
 
@@ -2697,6 +2858,26 @@ def compile(input_file_path,*output_file_name)
2697
2858
 
2698
2859
  def compile_operators(input_file_contents)
2699
2860
 
2861
+ def compile_power_operator(input_string)
2862
+
2863
+ matches = input_string.scan(/(\w{1,}\*\*\w{1,})/).to_a.flatten
2864
+
2865
+ unless matches.empty?
2866
+
2867
+ matches.each do |match|
2868
+
2869
+ left,right = match.split("**")
2870
+
2871
+ input_string = input_string.sub(match,"Math.pow(#{left},#{right})")
2872
+
2873
+ end
2874
+
2875
+ end
2876
+
2877
+ return input_string
2878
+
2879
+ end
2880
+
2700
2881
  input_file_contents = input_file_contents.collect {|element| element.sub(" and "," && ")}
2701
2882
 
2702
2883
  input_file_contents = input_file_contents.collect {|element| element.sub(" or "," || ")}
@@ -2707,13 +2888,15 @@ def compile(input_file_path,*output_file_name)
2707
2888
 
2708
2889
  input_file_contents = input_file_contents.collect {|element| element.sub("elsuf","else if")}
2709
2890
 
2891
+ input_file_contents = input_file_contents.collect {|element| compile_power_operator(element)}
2892
+
2710
2893
  return input_file_contents
2711
2894
 
2712
2895
  end
2713
2896
 
2714
- def pretty_print_nila(input_file_contents)
2897
+ def pretty_print_nila(input_file_contents,temporary_nila_file)
2898
+
2715
2899
 
2716
- #Implementation is pending
2717
2900
 
2718
2901
  end
2719
2902
 
@@ -2749,6 +2932,8 @@ def compile(input_file_path,*output_file_name)
2749
2932
 
2750
2933
  file_contents = compile_arrays(file_contents)
2751
2934
 
2935
+ file_contents = compile_strings(file_contents)
2936
+
2752
2937
  file_contents = compile_default_values(file_contents,temp_file)
2753
2938
 
2754
2939
  file_contents,named_functions,nested_functions = replace_named_functions(file_contents,temp_file)
@@ -2773,7 +2958,7 @@ def compile(input_file_path,*output_file_name)
2773
2958
 
2774
2959
  file_contents = compile_comments(file_contents,comments,temp_file)
2775
2960
 
2776
- file_contents = pretty_print_javascript(file_contents,temp_file,comments)
2961
+ file_contents = pretty_print_javascript(file_contents,temp_file)
2777
2962
 
2778
2963
  file_contents = compile_operators(file_contents)
2779
2964
 
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.1.4
4
+ version: 0.0.4.1.5
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-07-22 00:00:00.000000000 Z
12
+ date: 2013-07-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: shark
@@ -69,6 +69,8 @@ files:
69
69
  - shark/features/multiple_variable_initialization.feature
70
70
  - shark/features/regular_if.feature
71
71
  - shark/features/regular_while.feature
72
+ - shark/features/ruby_operators.feature
73
+ - shark/features/strings.feature
72
74
  - shark/features/unless_until.feature
73
75
  - shark/test_files/array_string_indexing.nila
74
76
  - shark/test_files/correct.js
@@ -76,21 +78,25 @@ files:
76
78
  - shark/test_files/correct_indexing.js
77
79
  - shark/test_files/correct_initialization.js
78
80
  - shark/test_files/correct_multiple_return.js
81
+ - shark/test_files/correct_operators.js
79
82
  - shark/test_files/correct_regular_if.js
80
83
  - shark/test_files/correct_regular_while.js
81
84
  - shark/test_files/correct_return.js
82
85
  - shark/test_files/correct_single_return.js
86
+ - shark/test_files/correct_string_operators.js
83
87
  - shark/test_files/correct_unless_until.js
84
88
  - shark/test_files/default_parameters.nila
85
89
  - shark/test_files/erratic.nila
86
90
  - shark/test_files/multiple_initialization.nila
87
91
  - shark/test_files/multiple_return.nila
88
92
  - shark/test_files/no_return.nila
93
+ - shark/test_files/operators.nila
89
94
  - shark/test_files/perfect.js
90
95
  - shark/test_files/regular_if.nila
91
96
  - shark/test_files/regular_while.nila
92
97
  - shark/test_files/simple.nila
93
98
  - shark/test_files/single_return.nila
99
+ - shark/test_files/string_operators.nila
94
100
  - shark/test_files/unless_until.nila
95
101
  - src/nilac.rb
96
102
  homepage: http://adhithyan15.github.com/nila