nudge 0.0.2 → 0.1.0

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.
Files changed (883) hide show
  1. data/.gitignore +1 -0
  2. data/Rakefile +11 -7
  3. data/VERSION +1 -1
  4. data/lib/instructions/bool/bool_and.rb +19 -0
  5. data/lib/instructions/bool/bool_define.rb +6 -0
  6. data/lib/instructions/bool/bool_depth.rb +6 -0
  7. data/lib/instructions/bool/bool_duplicate.rb +6 -0
  8. data/lib/instructions/bool/bool_equal_q.rb +19 -0
  9. data/lib/instructions/bool/bool_flush.rb +6 -0
  10. data/lib/instructions/bool/bool_not.rb +18 -0
  11. data/lib/instructions/bool/bool_or.rb +19 -0
  12. data/lib/instructions/bool/bool_pop.rb +6 -0
  13. data/lib/instructions/bool/bool_random.rb +13 -0
  14. data/lib/instructions/bool/bool_rotate.rb +6 -0
  15. data/lib/instructions/bool/bool_shove.rb +6 -0
  16. data/lib/instructions/bool/bool_swap.rb +6 -0
  17. data/lib/instructions/bool/bool_xor.rb +19 -0
  18. data/lib/instructions/bool/bool_yank.rb +6 -0
  19. data/lib/instructions/bool/bool_yankdup.rb +6 -0
  20. data/lib/instructions/code/code_atom_q.rb +16 -0
  21. data/lib/instructions/code/code_backbone_points.rb +24 -0
  22. data/lib/instructions/code/code_car.rb +20 -0
  23. data/lib/instructions/code/code_cdr.rb +20 -0
  24. data/lib/instructions/code/code_concatenate.rb +31 -0
  25. data/lib/instructions/code/code_cons.rb +25 -0
  26. data/lib/instructions/code/code_container.rb +28 -0
  27. data/lib/instructions/code/code_contains_q.rb +22 -0
  28. data/lib/instructions/code/code_define.rb +21 -0
  29. data/lib/instructions/code/code_depth.rb +6 -0
  30. data/lib/instructions/code/code_discrepancy.rb +29 -0
  31. data/lib/instructions/code/code_do_count.rb +27 -0
  32. data/lib/instructions/code/code_do_range.rb +42 -0
  33. data/lib/instructions/code/code_do_times.rb +38 -0
  34. data/lib/instructions/code/code_duplicate.rb +6 -0
  35. data/lib/instructions/code/code_equal_q.rb +17 -0
  36. data/lib/instructions/code/code_execute.rb +19 -0
  37. data/lib/instructions/code/code_execute_then_pop.rb +20 -0
  38. data/lib/instructions/code/code_flush.rb +6 -0
  39. data/lib/instructions/code/code_gsub.rb +35 -0
  40. data/lib/instructions/code/code_if.rb +22 -0
  41. data/lib/instructions/code/code_instructions.rb +15 -0
  42. data/lib/instructions/code/code_list.rb +19 -0
  43. data/lib/instructions/code/code_member_q.rb +26 -0
  44. data/lib/instructions/code/code_name_lookup.rb +19 -0
  45. data/lib/instructions/code/code_nth.rb +24 -0
  46. data/lib/instructions/code/code_nth_cdr.rb +30 -0
  47. data/lib/instructions/code/code_nth_point.rb +21 -0
  48. data/lib/instructions/code/code_null_q.rb +15 -0
  49. data/lib/instructions/code/code_parses_q.rb +15 -0
  50. data/lib/instructions/code/code_points.rb +19 -0
  51. data/lib/instructions/code/code_pop.rb +6 -0
  52. data/lib/instructions/code/code_position.rb +22 -0
  53. data/lib/instructions/code/code_quote.rb +14 -0
  54. data/lib/instructions/code/code_replace_nth_point.rb +30 -0
  55. data/lib/instructions/code/code_rotate.rb +6 -0
  56. data/lib/instructions/code/code_shove.rb +6 -0
  57. data/lib/instructions/code/code_swap.rb +6 -0
  58. data/lib/instructions/code/code_yank.rb +6 -0
  59. data/lib/instructions/code/code_yankdup.rb +6 -0
  60. data/lib/instructions/conversion/bool_from_float.rb +14 -0
  61. data/lib/instructions/conversion/bool_from_int.rb +14 -0
  62. data/lib/instructions/conversion/code_from_bool.rb +16 -0
  63. data/lib/instructions/conversion/code_from_float.rb +16 -0
  64. data/lib/instructions/conversion/code_from_int.rb +17 -0
  65. data/lib/instructions/conversion/code_from_name.rb +16 -0
  66. data/lib/instructions/conversion/float_from_bool.rb +14 -0
  67. data/lib/instructions/conversion/float_from_int.rb +14 -0
  68. data/lib/instructions/conversion/int_from_bool.rb +14 -0
  69. data/lib/instructions/conversion/int_from_float.rb +14 -0
  70. data/lib/instructions/exec/exec_define.rb +6 -0
  71. data/lib/instructions/exec/exec_depth.rb +6 -0
  72. data/lib/instructions/exec/exec_do_count.rb +23 -0
  73. data/lib/instructions/exec/exec_do_range.rb +36 -0
  74. data/lib/instructions/exec/exec_do_times.rb +34 -0
  75. data/lib/instructions/exec/exec_duplicate.rb +6 -0
  76. data/lib/instructions/exec/exec_equal_q.rb +17 -0
  77. data/lib/instructions/exec/exec_flush.rb +6 -0
  78. data/lib/instructions/exec/exec_if.rb +8 -0
  79. data/lib/instructions/exec/exec_k.rb +14 -0
  80. data/lib/instructions/exec/exec_pop.rb +6 -0
  81. data/lib/instructions/exec/exec_rotate.rb +6 -0
  82. data/lib/instructions/exec/exec_s.rb +18 -0
  83. data/lib/instructions/exec/exec_shove.rb +6 -0
  84. data/lib/instructions/exec/exec_swap.rb +6 -0
  85. data/lib/instructions/exec/exec_y.rb +15 -0
  86. data/lib/instructions/exec/exec_yank.rb +6 -0
  87. data/lib/instructions/exec/exec_yankdup.rb +6 -0
  88. data/lib/instructions/float/float_abs.rb +14 -0
  89. data/lib/instructions/float/float_add.rb +15 -0
  90. data/lib/instructions/float/float_cosine.rb +14 -0
  91. data/lib/instructions/float/float_define.rb +6 -0
  92. data/lib/instructions/float/float_depth.rb +6 -0
  93. data/lib/instructions/float/float_divide.rb +20 -0
  94. data/lib/instructions/float/float_duplicate.rb +6 -0
  95. data/lib/instructions/float/float_equal_q.rb +15 -0
  96. data/lib/instructions/float/float_flush.rb +6 -0
  97. data/lib/instructions/float/float_greater_than_q.rb +15 -0
  98. data/lib/instructions/float/float_if.rb +8 -0
  99. data/lib/instructions/float/float_less_than_q.rb +15 -0
  100. data/lib/instructions/float/float_max.rb +15 -0
  101. data/lib/instructions/float/float_min.rb +15 -0
  102. data/lib/instructions/float/float_modulo.rb +20 -0
  103. data/lib/instructions/float/float_multiply.rb +15 -0
  104. data/lib/instructions/float/float_negative.rb +14 -0
  105. data/lib/instructions/float/float_pop.rb +6 -0
  106. data/lib/instructions/float/float_power.rb +20 -0
  107. data/lib/instructions/float/float_random.rb +13 -0
  108. data/lib/instructions/float/float_rotate.rb +6 -0
  109. data/lib/instructions/float/float_shove.rb +6 -0
  110. data/lib/instructions/float/float_sine.rb +14 -0
  111. data/lib/instructions/float/float_sqrt.rb +18 -0
  112. data/lib/instructions/float/float_subtract.rb +15 -0
  113. data/lib/instructions/float/float_swap.rb +6 -0
  114. data/lib/instructions/float/float_tangent.rb +14 -0
  115. data/lib/instructions/float/float_yank.rb +6 -0
  116. data/lib/instructions/float/float_yankdup.rb +6 -0
  117. data/lib/instructions/infrastructure.rb +335 -17
  118. data/lib/instructions/int/int_abs.rb +14 -0
  119. data/lib/instructions/int/int_add.rb +15 -0
  120. data/lib/instructions/int/int_define.rb +6 -0
  121. data/lib/instructions/int/int_depth.rb +6 -0
  122. data/lib/instructions/int/int_divide.rb +20 -0
  123. data/lib/instructions/int/int_duplicate.rb +6 -0
  124. data/lib/instructions/int/int_equal_q.rb +15 -0
  125. data/lib/instructions/int/int_flush.rb +6 -0
  126. data/lib/instructions/int/int_greater_than_q.rb +15 -0
  127. data/lib/instructions/int/int_if.rb +8 -0
  128. data/lib/instructions/int/int_less_than_q.rb +15 -0
  129. data/lib/instructions/int/int_max.rb +16 -0
  130. data/lib/instructions/int/int_min.rb +16 -0
  131. data/lib/instructions/int/int_modulo.rb +20 -0
  132. data/lib/instructions/int/int_multiply.rb +15 -0
  133. data/lib/instructions/int/int_negative.rb +14 -0
  134. data/lib/instructions/int/int_pop.rb +6 -0
  135. data/lib/instructions/int/int_power.rb +16 -0
  136. data/lib/instructions/int/int_random.rb +13 -0
  137. data/lib/instructions/int/int_rotate.rb +6 -0
  138. data/lib/instructions/int/int_shove.rb +6 -0
  139. data/lib/instructions/int/int_subtract.rb +16 -0
  140. data/lib/instructions/int/int_swap.rb +6 -0
  141. data/lib/instructions/int/int_yank.rb +6 -0
  142. data/lib/instructions/int/int_yankdup.rb +6 -0
  143. data/lib/instructions/name/name_depth.rb +6 -0
  144. data/lib/instructions/name/name_disable_lookup.rb +12 -0
  145. data/lib/instructions/name/name_duplicate.rb +6 -0
  146. data/lib/instructions/name/name_equal_q.rb +15 -0
  147. data/lib/instructions/name/name_flush.rb +6 -0
  148. data/lib/instructions/name/name_next.rb +14 -0
  149. data/lib/instructions/name/name_pop.rb +6 -0
  150. data/lib/instructions/name/name_random_bound.rb +14 -0
  151. data/lib/instructions/name/name_rotate.rb +6 -0
  152. data/lib/instructions/name/name_shove.rb +6 -0
  153. data/lib/instructions/name/name_swap.rb +6 -0
  154. data/lib/instructions/name/name_unbind.rb +17 -0
  155. data/lib/instructions/name/name_yank.rb +6 -0
  156. data/lib/instructions/name/name_yankdup.rb +6 -0
  157. data/lib/interpreter/grammars/nudge_codeblock.treetop +17 -0
  158. data/lib/interpreter/grammars/nudge_codeblock_helpers.rb +19 -0
  159. data/lib/interpreter/grammars/nudge_common.treetop +15 -0
  160. data/lib/interpreter/grammars/nudge_instruction.treetop +14 -0
  161. data/lib/interpreter/grammars/nudge_instruction_helpers.rb +14 -0
  162. data/lib/interpreter/grammars/nudge_reference.treetop +9 -0
  163. data/lib/interpreter/grammars/nudge_reference_helpers.rb +14 -0
  164. data/lib/interpreter/grammars/nudge_value.treetop +14 -0
  165. data/lib/interpreter/grammars/nudge_value_helpers.rb +19 -0
  166. data/lib/interpreter/interpreter.rb +74 -23
  167. data/lib/interpreter/nudge_program.rb +253 -0
  168. data/lib/interpreter/parse.tab.rb +264 -0
  169. data/lib/interpreter/programPoints.rb +119 -98
  170. data/lib/interpreter/types/codeType.rb +114 -89
  171. data/lib/interpreter/types/pushTypes.rb +33 -20
  172. data/lib/nudge.rb +25 -26
  173. data/readme.md +13 -10
  174. data/spec/fixtures/long_arithmetic.example +7 -4
  175. data/spec/instructions/bool/bool_and_spec.rb +61 -0
  176. data/spec/instructions/bool/bool_define_spec.rb +69 -0
  177. data/spec/instructions/bool/bool_depth_spec.rb +39 -0
  178. data/spec/instructions/bool/bool_equal_q_spec.rb +61 -0
  179. data/spec/instructions/bool/bool_flush_spec.rb +37 -0
  180. data/spec/instructions/bool/bool_not_spec.rb +61 -0
  181. data/spec/instructions/bool/bool_or_spec.rb +61 -0
  182. data/spec/instructions/bool/bool_random_spec.rb +39 -0
  183. data/spec/instructions/bool/bool_shove_spec.rb +69 -0
  184. data/spec/instructions/bool/bool_xor_spec.rb +61 -0
  185. data/spec/instructions/bool/bool_yank_spec.rb +71 -0
  186. data/spec/instructions/bool/bool_yankdup_spec.rb +70 -0
  187. data/spec/instructions/code/code_atom_q_spec.rb +44 -0
  188. data/spec/instructions/code/code_backbone_points_spec.rb +57 -0
  189. data/spec/instructions/code/code_car_spec.rb +50 -0
  190. data/spec/instructions/code/code_cdr_spec.rb +51 -0
  191. data/spec/instructions/code/code_concatenate_spec.rb +81 -0
  192. data/spec/instructions/code/code_cons_spec.rb +63 -0
  193. data/spec/instructions/code/code_container_spec.rb +77 -0
  194. data/spec/instructions/code/code_contains_q_spec.rb +82 -0
  195. data/spec/instructions/code/code_define_spec.rb +76 -0
  196. data/spec/instructions/code/code_discrepancy_spec.rb +81 -0
  197. data/spec/instructions/code/code_do_count_spec.rb +83 -0
  198. data/spec/instructions/code/code_do_range_spec.rb +113 -0
  199. data/spec/instructions/code/code_do_times_spec.rb +116 -0
  200. data/spec/instructions/code/code_equal_q_spec.rb +49 -0
  201. data/spec/instructions/code/code_execute_spec.rb +52 -0
  202. data/spec/instructions/code/code_execute_then_pop_spec.rb +61 -0
  203. data/spec/instructions/code/code_fromname_spec.rb +37 -0
  204. data/spec/instructions/code/code_gsub_spec.rb +112 -0
  205. data/spec/instructions/code/code_if_spec.rb +53 -0
  206. data/spec/instructions/code/code_instructions_spec.rb +42 -0
  207. data/spec/instructions/code/code_list_spec.rb +49 -0
  208. data/spec/instructions/code/code_member_q_spec.rb +77 -0
  209. data/spec/instructions/code/code_name_lookup_spec.rb +65 -0
  210. data/spec/instructions/code/code_noop_spec.rb +38 -0
  211. data/spec/instructions/code/code_nth_cdr_spec.rb +77 -0
  212. data/spec/instructions/code/code_nth_point_spec.rb +67 -0
  213. data/spec/instructions/code/code_nth_spec.rb +62 -0
  214. data/spec/instructions/code/code_null_q_spec.rb +44 -0
  215. data/spec/instructions/code/code_parses_q_spec.rb +73 -0
  216. data/spec/instructions/code/code_points_spec.rb +49 -0
  217. data/spec/instructions/code/code_position_spec.rb +74 -0
  218. data/spec/instructions/code/code_quote_spec.rb +53 -0
  219. data/spec/instructions/code/code_replace_nth_point_spec.rb +115 -0
  220. data/spec/instructions/code/code_stack_spec.rb +386 -0
  221. data/spec/instructions/exec/exec_define_spec.rb +70 -0
  222. data/spec/instructions/exec/exec_depth_spec.rb +39 -0
  223. data/spec/instructions/exec/exec_do_count_spec.rb +79 -0
  224. data/spec/instructions/exec/exec_do_range_spec.rb +98 -0
  225. data/spec/instructions/exec/exec_do_times_spec.rb +105 -0
  226. data/spec/instructions/exec/exec_duplicate_spec.rb +44 -0
  227. data/spec/instructions/exec/exec_equal_q_spec.rb +50 -0
  228. data/spec/instructions/exec/exec_flush_spec.rb +37 -0
  229. data/spec/instructions/exec/exec_if_spec.rb +51 -0
  230. data/spec/instructions/exec/exec_k_spec.rb +39 -0
  231. data/spec/instructions/exec/exec_pop_spec.rb +38 -0
  232. data/spec/instructions/exec/exec_rotate_spec.rb +40 -0
  233. data/spec/instructions/exec/exec_s_spec.rb +41 -0
  234. data/spec/instructions/exec/exec_shove_spec.rb +68 -0
  235. data/spec/instructions/exec/exec_swap_spec.rb +41 -0
  236. data/spec/instructions/exec/exec_y_spec.rb +41 -0
  237. data/spec/instructions/exec/exec_yank_spec.rb +66 -0
  238. data/spec/instructions/exec/exec_yankdup_spec.rb +69 -0
  239. data/spec/instructions/float/float_abs_spec.rb +50 -0
  240. data/spec/instructions/float/float_add_spec.rb +50 -0
  241. data/spec/instructions/float/float_cosine_spec.rb +61 -0
  242. data/spec/instructions/float/float_define_spec.rb +69 -0
  243. data/spec/instructions/float/float_depth_spec.rb +39 -0
  244. data/spec/instructions/float/float_divide_spec.rb +59 -0
  245. data/spec/instructions/float/float_equal_q_spec.rb +53 -0
  246. data/spec/instructions/float/float_flush_spec.rb +37 -0
  247. data/spec/instructions/float/float_greater_than_q_spec.rb +59 -0
  248. data/spec/instructions/float/float_if_spec.rb +49 -0
  249. data/spec/instructions/float/float_less_than_q_spec.rb +59 -0
  250. data/spec/instructions/float/float_max_spec.rb +51 -0
  251. data/spec/instructions/float/float_min_spec.rb +51 -0
  252. data/spec/instructions/float/float_modulo_spec.rb +59 -0
  253. data/spec/instructions/float/float_multiply_spec.rb +51 -0
  254. data/spec/instructions/float/float_negative_spec.rb +51 -0
  255. data/spec/instructions/float/float_power_spec.rb +59 -0
  256. data/spec/instructions/float/float_random_spec.rb +36 -0
  257. data/spec/instructions/float/float_shove_spec.rb +67 -0
  258. data/spec/instructions/float/float_sine_spec.rb +61 -0
  259. data/spec/instructions/float/float_sqrt_spec.rb +60 -0
  260. data/spec/instructions/float/float_subtract_spec.rb +51 -0
  261. data/spec/instructions/float/float_tangent_spec.rb +62 -0
  262. data/spec/instructions/float/float_yank_spec.rb +65 -0
  263. data/spec/instructions/float/float_yankdup_spec.rb +70 -0
  264. data/spec/instructions/instruction_class_spec.rb +31 -0
  265. data/spec/instructions/int/int_abs_spec.rb +61 -0
  266. data/spec/instructions/int/int_add_spec.rb +60 -0
  267. data/spec/instructions/int/int_define_spec.rb +73 -0
  268. data/spec/instructions/int/int_depth_spec.rb +37 -0
  269. data/spec/instructions/int/int_divide_spec.rb +69 -0
  270. data/spec/instructions/int/int_equal_q_spec.rb +52 -0
  271. data/spec/instructions/int/int_flush_spec.rb +37 -0
  272. data/spec/instructions/int/int_greater_than_q_spec.rb +59 -0
  273. data/spec/instructions/int/int_if_spec.rb +48 -0
  274. data/spec/instructions/int/int_less_than_q_spec.rb +59 -0
  275. data/spec/instructions/int/int_max_spec.rb +61 -0
  276. data/spec/instructions/int/int_min_spec.rb +61 -0
  277. data/spec/instructions/int/int_modulo_spec.rb +69 -0
  278. data/spec/instructions/int/int_multiply_spec.rb +61 -0
  279. data/spec/instructions/int/int_negative_spec.rb +61 -0
  280. data/spec/instructions/int/int_power_spec.rb +73 -0
  281. data/spec/instructions/int/int_random_spec.rb +36 -0
  282. data/spec/instructions/int/int_shove_spec.rb +67 -0
  283. data/spec/instructions/int/int_subtract_spec.rb +61 -0
  284. data/spec/instructions/int/int_yank_spec.rb +85 -0
  285. data/spec/instructions/int/int_yankdup_spec.rb +70 -0
  286. data/spec/instructions/name/name_depth_spec.rb +39 -0
  287. data/spec/instructions/name/name_disable_lookup_spec.rb +47 -0
  288. data/spec/instructions/name/name_equal_q_spec.rb +38 -0
  289. data/spec/instructions/name/name_flush_spec.rb +37 -0
  290. data/spec/instructions/name/name_next_spec.rb +39 -0
  291. data/spec/instructions/name/name_random_bound_spec.rb +57 -0
  292. data/spec/instructions/name/name_shove_spec.rb +67 -0
  293. data/spec/instructions/name/name_unbind_spec.rb +62 -0
  294. data/spec/instructions/name/name_yank_spec.rb +65 -0
  295. data/spec/instructions/name/name_yankdup_spec.rb +69 -0
  296. data/spec/instructions/split_these/bool_stack_spec.rb +95 -0
  297. data/spec/instructions/split_these/conversions_spec.rb +103 -0
  298. data/spec/instructions/split_these/float_stack_spec.rb +92 -0
  299. data/spec/instructions/split_these/int_stack_spec.rb +81 -0
  300. data/spec/instructions/split_these/name_stack_spec.rb +84 -0
  301. data/spec/interpreter/codeblock_point_spec.rb +164 -0
  302. data/spec/interpreter/codetype_spec.rb +219 -185
  303. data/spec/interpreter/instruction_spec.rb +87 -25
  304. data/spec/interpreter/interpreter_spec.rb +230 -36
  305. data/spec/interpreter/nil_point_spec.rb +32 -0
  306. data/spec/interpreter/nudge_program_spec.rb +774 -0
  307. data/spec/interpreter/reference_point_spec.rb +73 -0
  308. data/spec/interpreter/stack_spec.rb +1 -1
  309. data/spec/interpreter/treetophelpers.rb +94 -1
  310. data/spec/interpreter/types_spec.rb +125 -77
  311. data/spec/interpreter/value_point_spec.rb +173 -0
  312. data/spec/parsers/nudge_program_parser_spec.rb +86 -0
  313. data/spec/spec_helper.rb +26 -2
  314. metadata +464 -664
  315. data/_spikes/couch_document_spike.rb +0 -24
  316. data/_spikes/nested_parsing/nested.treetop +0 -6
  317. data/_spikes/nudge3_syntax_spike.txt +0 -23
  318. data/_spikes/nudgeview/init.rb +0 -19
  319. data/_spikes/nudgeview/public/javascripts/app.js +0 -12
  320. data/_spikes/nudgeview/public/javascripts/jquery.js +0 -4376
  321. data/_spikes/nudgeview/public/javascripts/jquery.svg.js +0 -1325
  322. data/_spikes/nudgeview/views/index.erb +0 -18
  323. data/_spikes/nudgeview/views/index.haml +0 -8
  324. data/_spikes/simplestWeb/simplest.rb +0 -44
  325. data/_spikes/simplestWeb/views/main.erb +0 -19
  326. data/_spikes/sketches/nudgecode_spike.rb +0 -146
  327. data/_spikes/sketches/searchDSL_spike.rb +0 -25
  328. data/_spikes/sketches/search_operator_sketch_spike.txt +0 -287
  329. data/_spikes/sketches/searchspace_spike.rb +0 -96
  330. data/_spikes/symbolic_regression/activate.rb +0 -35
  331. data/_spikes/symbolic_regression/config/environment.rb +0 -340
  332. data/_spikes/symbolic_regression/config/environments/deployment.rb +0 -0
  333. data/_spikes/symbolic_regression/config/environments/development.rb +0 -0
  334. data/_spikes/symbolic_regression/experiment/objectives/programLength.rb +0 -2
  335. data/_spikes/symbolic_regression/experiment/objectives/summedSquaredError.rb +0 -2
  336. data/_spikes/symbolic_regression/lib/tasks/run.rake +0 -0
  337. data/app_generators/nudge/USAGE +0 -5
  338. data/app_generators/nudge/nudge_generator.rb +0 -73
  339. data/app_generators/nudge/templates/activate.rb +0 -0
  340. data/bin/nudge +0 -17
  341. data/doc/classes/BlockNode.html +0 -146
  342. data/doc/classes/BlockNode.src/M000246.html +0 -18
  343. data/doc/classes/BoolAndInstruction.html +0 -218
  344. data/doc/classes/BoolAndInstruction.src/M000003.html +0 -15
  345. data/doc/classes/BoolAndInstruction.src/M000004.html +0 -16
  346. data/doc/classes/BoolAndInstruction.src/M000005.html +0 -15
  347. data/doc/classes/BoolAndInstruction.src/M000006.html +0 -15
  348. data/doc/classes/BoolEqualQInstruction.html +0 -218
  349. data/doc/classes/BoolEqualQInstruction.src/M000015.html +0 -15
  350. data/doc/classes/BoolEqualQInstruction.src/M000016.html +0 -16
  351. data/doc/classes/BoolEqualQInstruction.src/M000017.html +0 -15
  352. data/doc/classes/BoolEqualQInstruction.src/M000018.html +0 -15
  353. data/doc/classes/BoolFromFloatInstruction.html +0 -218
  354. data/doc/classes/BoolFromFloatInstruction.src/M000071.html +0 -15
  355. data/doc/classes/BoolFromFloatInstruction.src/M000072.html +0 -15
  356. data/doc/classes/BoolFromFloatInstruction.src/M000073.html +0 -15
  357. data/doc/classes/BoolFromFloatInstruction.src/M000074.html +0 -15
  358. data/doc/classes/BoolFromIntInstruction.html +0 -218
  359. data/doc/classes/BoolFromIntInstruction.src/M000067.html +0 -15
  360. data/doc/classes/BoolFromIntInstruction.src/M000068.html +0 -15
  361. data/doc/classes/BoolFromIntInstruction.src/M000069.html +0 -15
  362. data/doc/classes/BoolFromIntInstruction.src/M000070.html +0 -15
  363. data/doc/classes/BoolNotInstruction.html +0 -218
  364. data/doc/classes/BoolNotInstruction.src/M000019.html +0 -15
  365. data/doc/classes/BoolNotInstruction.src/M000020.html +0 -15
  366. data/doc/classes/BoolNotInstruction.src/M000021.html +0 -15
  367. data/doc/classes/BoolNotInstruction.src/M000022.html +0 -15
  368. data/doc/classes/BoolOrInstruction.html +0 -218
  369. data/doc/classes/BoolOrInstruction.src/M000007.html +0 -15
  370. data/doc/classes/BoolOrInstruction.src/M000008.html +0 -16
  371. data/doc/classes/BoolOrInstruction.src/M000009.html +0 -15
  372. data/doc/classes/BoolOrInstruction.src/M000010.html +0 -15
  373. data/doc/classes/BoolRandomInstruction.html +0 -218
  374. data/doc/classes/BoolRandomInstruction.src/M000187.html +0 -15
  375. data/doc/classes/BoolRandomInstruction.src/M000188.html +0 -14
  376. data/doc/classes/BoolRandomInstruction.src/M000189.html +0 -15
  377. data/doc/classes/BoolRandomInstruction.src/M000190.html +0 -15
  378. data/doc/classes/BoolType.html +0 -196
  379. data/doc/classes/BoolType.src/M000240.html +0 -16
  380. data/doc/classes/BoolType.src/M000241.html +0 -15
  381. data/doc/classes/BoolType.src/M000242.html +0 -15
  382. data/doc/classes/BoolXorInstruction.html +0 -218
  383. data/doc/classes/BoolXorInstruction.src/M000011.html +0 -15
  384. data/doc/classes/BoolXorInstruction.src/M000012.html +0 -16
  385. data/doc/classes/BoolXorInstruction.src/M000013.html +0 -15
  386. data/doc/classes/BoolXorInstruction.src/M000014.html +0 -15
  387. data/doc/classes/ChannelNode.html +0 -161
  388. data/doc/classes/ChannelNode.src/M000249.html +0 -15
  389. data/doc/classes/ChannelNode.src/M000250.html +0 -16
  390. data/doc/classes/CodeType.html +0 -269
  391. data/doc/classes/CodeType.src/M000219.html +0 -38
  392. data/doc/classes/CodeType.src/M000220.html +0 -16
  393. data/doc/classes/CodeType.src/M000221.html +0 -16
  394. data/doc/classes/CodeType.src/M000222.html +0 -16
  395. data/doc/classes/CodeType.src/M000223.html +0 -24
  396. data/doc/classes/CodeType.src/M000224.html +0 -42
  397. data/doc/classes/ERCNode.html +0 -183
  398. data/doc/classes/ERCNode.src/M000254.html +0 -15
  399. data/doc/classes/ERCNode.src/M000255.html +0 -16
  400. data/doc/classes/ERCNode.src/M000256.html +0 -16
  401. data/doc/classes/ExecPopInstruction.html +0 -218
  402. data/doc/classes/ExecPopInstruction.src/M000075.html +0 -15
  403. data/doc/classes/ExecPopInstruction.src/M000076.html +0 -14
  404. data/doc/classes/ExecPopInstruction.src/M000077.html +0 -15
  405. data/doc/classes/ExecPopInstruction.src/M000078.html +0 -14
  406. data/doc/classes/FloatAbsInstruction.html +0 -218
  407. data/doc/classes/FloatAbsInstruction.src/M000107.html +0 -15
  408. data/doc/classes/FloatAbsInstruction.src/M000108.html +0 -15
  409. data/doc/classes/FloatAbsInstruction.src/M000109.html +0 -15
  410. data/doc/classes/FloatAbsInstruction.src/M000110.html +0 -15
  411. data/doc/classes/FloatAddInstruction.html +0 -218
  412. data/doc/classes/FloatAddInstruction.src/M000079.html +0 -15
  413. data/doc/classes/FloatAddInstruction.src/M000080.html +0 -16
  414. data/doc/classes/FloatAddInstruction.src/M000081.html +0 -15
  415. data/doc/classes/FloatAddInstruction.src/M000082.html +0 -15
  416. data/doc/classes/FloatCosineInstruction.html +0 -218
  417. data/doc/classes/FloatCosineInstruction.src/M000123.html +0 -15
  418. data/doc/classes/FloatCosineInstruction.src/M000124.html +0 -15
  419. data/doc/classes/FloatCosineInstruction.src/M000125.html +0 -15
  420. data/doc/classes/FloatCosineInstruction.src/M000126.html +0 -15
  421. data/doc/classes/FloatDivideInstruction.html +0 -218
  422. data/doc/classes/FloatDivideInstruction.src/M000091.html +0 -15
  423. data/doc/classes/FloatDivideInstruction.src/M000092.html +0 -16
  424. data/doc/classes/FloatDivideInstruction.src/M000093.html +0 -20
  425. data/doc/classes/FloatDivideInstruction.src/M000094.html +0 -15
  426. data/doc/classes/FloatFromBoolInstruction.html +0 -218
  427. data/doc/classes/FloatFromBoolInstruction.src/M000055.html +0 -15
  428. data/doc/classes/FloatFromBoolInstruction.src/M000056.html +0 -15
  429. data/doc/classes/FloatFromBoolInstruction.src/M000057.html +0 -15
  430. data/doc/classes/FloatFromBoolInstruction.src/M000058.html +0 -15
  431. data/doc/classes/FloatFromIntInstruction.html +0 -218
  432. data/doc/classes/FloatFromIntInstruction.src/M000063.html +0 -15
  433. data/doc/classes/FloatFromIntInstruction.src/M000064.html +0 -15
  434. data/doc/classes/FloatFromIntInstruction.src/M000065.html +0 -15
  435. data/doc/classes/FloatFromIntInstruction.src/M000066.html +0 -15
  436. data/doc/classes/FloatGreaterThanQInstruction.html +0 -218
  437. data/doc/classes/FloatGreaterThanQInstruction.src/M000035.html +0 -15
  438. data/doc/classes/FloatGreaterThanQInstruction.src/M000036.html +0 -16
  439. data/doc/classes/FloatGreaterThanQInstruction.src/M000037.html +0 -15
  440. data/doc/classes/FloatGreaterThanQInstruction.src/M000038.html +0 -15
  441. data/doc/classes/FloatIfInstruction.html +0 -218
  442. data/doc/classes/FloatIfInstruction.src/M000047.html +0 -16
  443. data/doc/classes/FloatIfInstruction.src/M000048.html +0 -15
  444. data/doc/classes/FloatIfInstruction.src/M000049.html +0 -14
  445. data/doc/classes/FloatIfInstruction.src/M000050.html +0 -17
  446. data/doc/classes/FloatLessThanQInstruction.html +0 -218
  447. data/doc/classes/FloatLessThanQInstruction.src/M000039.html +0 -15
  448. data/doc/classes/FloatLessThanQInstruction.src/M000040.html +0 -16
  449. data/doc/classes/FloatLessThanQInstruction.src/M000041.html +0 -15
  450. data/doc/classes/FloatLessThanQInstruction.src/M000042.html +0 -15
  451. data/doc/classes/FloatMaxInstruction.html +0 -218
  452. data/doc/classes/FloatMaxInstruction.src/M000095.html +0 -15
  453. data/doc/classes/FloatMaxInstruction.src/M000096.html +0 -16
  454. data/doc/classes/FloatMaxInstruction.src/M000097.html +0 -15
  455. data/doc/classes/FloatMaxInstruction.src/M000098.html +0 -15
  456. data/doc/classes/FloatMinInstruction.html +0 -218
  457. data/doc/classes/FloatMinInstruction.src/M000099.html +0 -15
  458. data/doc/classes/FloatMinInstruction.src/M000100.html +0 -16
  459. data/doc/classes/FloatMinInstruction.src/M000101.html +0 -15
  460. data/doc/classes/FloatMinInstruction.src/M000102.html +0 -15
  461. data/doc/classes/FloatMultiplyInstruction.html +0 -218
  462. data/doc/classes/FloatMultiplyInstruction.src/M000083.html +0 -15
  463. data/doc/classes/FloatMultiplyInstruction.src/M000084.html +0 -16
  464. data/doc/classes/FloatMultiplyInstruction.src/M000085.html +0 -15
  465. data/doc/classes/FloatMultiplyInstruction.src/M000086.html +0 -15
  466. data/doc/classes/FloatNegativeInstruction.html +0 -218
  467. data/doc/classes/FloatNegativeInstruction.src/M000103.html +0 -15
  468. data/doc/classes/FloatNegativeInstruction.src/M000104.html +0 -15
  469. data/doc/classes/FloatNegativeInstruction.src/M000105.html +0 -15
  470. data/doc/classes/FloatNegativeInstruction.src/M000106.html +0 -15
  471. data/doc/classes/FloatPowerInstruction.html +0 -218
  472. data/doc/classes/FloatPowerInstruction.src/M000111.html +0 -15
  473. data/doc/classes/FloatPowerInstruction.src/M000112.html +0 -16
  474. data/doc/classes/FloatPowerInstruction.src/M000113.html +0 -20
  475. data/doc/classes/FloatPowerInstruction.src/M000114.html +0 -15
  476. data/doc/classes/FloatRandomInstruction.html +0 -218
  477. data/doc/classes/FloatRandomInstruction.src/M000191.html +0 -15
  478. data/doc/classes/FloatRandomInstruction.src/M000192.html +0 -14
  479. data/doc/classes/FloatRandomInstruction.src/M000193.html +0 -15
  480. data/doc/classes/FloatRandomInstruction.src/M000194.html +0 -15
  481. data/doc/classes/FloatSineInstruction.html +0 -218
  482. data/doc/classes/FloatSineInstruction.src/M000119.html +0 -15
  483. data/doc/classes/FloatSineInstruction.src/M000120.html +0 -15
  484. data/doc/classes/FloatSineInstruction.src/M000121.html +0 -15
  485. data/doc/classes/FloatSineInstruction.src/M000122.html +0 -15
  486. data/doc/classes/FloatSqrtInstruction.html +0 -218
  487. data/doc/classes/FloatSqrtInstruction.src/M000115.html +0 -15
  488. data/doc/classes/FloatSqrtInstruction.src/M000116.html +0 -15
  489. data/doc/classes/FloatSqrtInstruction.src/M000117.html +0 -19
  490. data/doc/classes/FloatSqrtInstruction.src/M000118.html +0 -15
  491. data/doc/classes/FloatSubtractInstruction.html +0 -218
  492. data/doc/classes/FloatSubtractInstruction.src/M000087.html +0 -15
  493. data/doc/classes/FloatSubtractInstruction.src/M000088.html +0 -16
  494. data/doc/classes/FloatSubtractInstruction.src/M000089.html +0 -15
  495. data/doc/classes/FloatSubtractInstruction.src/M000090.html +0 -15
  496. data/doc/classes/FloatTangentInstruction.html +0 -218
  497. data/doc/classes/FloatTangentInstruction.src/M000127.html +0 -15
  498. data/doc/classes/FloatTangentInstruction.src/M000128.html +0 -15
  499. data/doc/classes/FloatTangentInstruction.src/M000129.html +0 -15
  500. data/doc/classes/FloatTangentInstruction.src/M000130.html +0 -15
  501. data/doc/classes/FloatType.html +0 -196
  502. data/doc/classes/FloatType.src/M000243.html +0 -19
  503. data/doc/classes/FloatType.src/M000244.html +0 -15
  504. data/doc/classes/FloatType.src/M000245.html +0 -15
  505. data/doc/classes/Helpers.html +0 -161
  506. data/doc/classes/Helpers.src/M000343.html +0 -21
  507. data/doc/classes/Helpers.src/M000344.html +0 -24
  508. data/doc/classes/Instruction/InstructionMethodError.html +0 -110
  509. data/doc/classes/Instruction/NaNResultError.html +0 -110
  510. data/doc/classes/Instruction/NotEnoughStackItems.html +0 -110
  511. data/doc/classes/Instruction.html +0 -500
  512. data/doc/classes/Instruction.src/M000131.html +0 -17
  513. data/doc/classes/Instruction.src/M000132.html +0 -15
  514. data/doc/classes/Instruction.src/M000133.html +0 -15
  515. data/doc/classes/Instruction.src/M000134.html +0 -15
  516. data/doc/classes/Instruction.src/M000135.html +0 -15
  517. data/doc/classes/Instruction.src/M000136.html +0 -15
  518. data/doc/classes/Instruction.src/M000137.html +0 -15
  519. data/doc/classes/Instruction.src/M000138.html +0 -15
  520. data/doc/classes/Instruction.src/M000139.html +0 -22
  521. data/doc/classes/Instruction.src/M000140.html +0 -15
  522. data/doc/classes/Instruction.src/M000141.html +0 -25
  523. data/doc/classes/Instruction.src/M000142.html +0 -15
  524. data/doc/classes/Instruction.src/M000143.html +0 -15
  525. data/doc/classes/Instruction.src/M000144.html +0 -15
  526. data/doc/classes/Instruction.src/M000145.html +0 -15
  527. data/doc/classes/Instruction.src/M000146.html +0 -15
  528. data/doc/classes/InstructionNode.html +0 -161
  529. data/doc/classes/InstructionNode.src/M000247.html +0 -15
  530. data/doc/classes/InstructionNode.src/M000248.html +0 -16
  531. data/doc/classes/IntAbsInstruction.html +0 -218
  532. data/doc/classes/IntAbsInstruction.src/M000175.html +0 -15
  533. data/doc/classes/IntAbsInstruction.src/M000176.html +0 -15
  534. data/doc/classes/IntAbsInstruction.src/M000177.html +0 -15
  535. data/doc/classes/IntAbsInstruction.src/M000178.html +0 -15
  536. data/doc/classes/IntAddInstruction.html +0 -218
  537. data/doc/classes/IntAddInstruction.src/M000147.html +0 -15
  538. data/doc/classes/IntAddInstruction.src/M000148.html +0 -16
  539. data/doc/classes/IntAddInstruction.src/M000149.html +0 -15
  540. data/doc/classes/IntAddInstruction.src/M000150.html +0 -15
  541. data/doc/classes/IntDepthInstruction.html +0 -218
  542. data/doc/classes/IntDepthInstruction.src/M000211.html +0 -15
  543. data/doc/classes/IntDepthInstruction.src/M000212.html +0 -14
  544. data/doc/classes/IntDepthInstruction.src/M000213.html +0 -15
  545. data/doc/classes/IntDepthInstruction.src/M000214.html +0 -15
  546. data/doc/classes/IntDivideInstruction.html +0 -218
  547. data/doc/classes/IntDivideInstruction.src/M000155.html +0 -15
  548. data/doc/classes/IntDivideInstruction.src/M000156.html +0 -16
  549. data/doc/classes/IntDivideInstruction.src/M000157.html +0 -20
  550. data/doc/classes/IntDivideInstruction.src/M000158.html +0 -15
  551. data/doc/classes/IntDuplicateInstruction.html +0 -218
  552. data/doc/classes/IntDuplicateInstruction.src/M000203.html +0 -15
  553. data/doc/classes/IntDuplicateInstruction.src/M000204.html +0 -15
  554. data/doc/classes/IntDuplicateInstruction.src/M000205.html +0 -15
  555. data/doc/classes/IntDuplicateInstruction.src/M000206.html +0 -15
  556. data/doc/classes/IntEqualQInstruction.html +0 -218
  557. data/doc/classes/IntEqualQInstruction.src/M000023.html +0 -15
  558. data/doc/classes/IntEqualQInstruction.src/M000024.html +0 -16
  559. data/doc/classes/IntEqualQInstruction.src/M000025.html +0 -15
  560. data/doc/classes/IntEqualQInstruction.src/M000026.html +0 -15
  561. data/doc/classes/IntFlushInstruction.html +0 -218
  562. data/doc/classes/IntFlushInstruction.src/M000215.html +0 -15
  563. data/doc/classes/IntFlushInstruction.src/M000216.html +0 -14
  564. data/doc/classes/IntFlushInstruction.src/M000217.html +0 -14
  565. data/doc/classes/IntFlushInstruction.src/M000218.html +0 -15
  566. data/doc/classes/IntFromBoolInstruction.html +0 -218
  567. data/doc/classes/IntFromBoolInstruction.src/M000051.html +0 -15
  568. data/doc/classes/IntFromBoolInstruction.src/M000052.html +0 -15
  569. data/doc/classes/IntFromBoolInstruction.src/M000053.html +0 -15
  570. data/doc/classes/IntFromBoolInstruction.src/M000054.html +0 -15
  571. data/doc/classes/IntFromFloatInstruction.html +0 -218
  572. data/doc/classes/IntFromFloatInstruction.src/M000059.html +0 -15
  573. data/doc/classes/IntFromFloatInstruction.src/M000060.html +0 -15
  574. data/doc/classes/IntFromFloatInstruction.src/M000061.html +0 -15
  575. data/doc/classes/IntFromFloatInstruction.src/M000062.html +0 -15
  576. data/doc/classes/IntGreaterThanQInstruction.html +0 -218
  577. data/doc/classes/IntGreaterThanQInstruction.src/M000031.html +0 -15
  578. data/doc/classes/IntGreaterThanQInstruction.src/M000032.html +0 -16
  579. data/doc/classes/IntGreaterThanQInstruction.src/M000033.html +0 -15
  580. data/doc/classes/IntGreaterThanQInstruction.src/M000034.html +0 -15
  581. data/doc/classes/IntIfInstruction.html +0 -218
  582. data/doc/classes/IntIfInstruction.src/M000043.html +0 -16
  583. data/doc/classes/IntIfInstruction.src/M000044.html +0 -15
  584. data/doc/classes/IntIfInstruction.src/M000045.html +0 -14
  585. data/doc/classes/IntIfInstruction.src/M000046.html +0 -17
  586. data/doc/classes/IntLessThanQInstruction.html +0 -218
  587. data/doc/classes/IntLessThanQInstruction.src/M000027.html +0 -15
  588. data/doc/classes/IntLessThanQInstruction.src/M000028.html +0 -16
  589. data/doc/classes/IntLessThanQInstruction.src/M000029.html +0 -15
  590. data/doc/classes/IntLessThanQInstruction.src/M000030.html +0 -15
  591. data/doc/classes/IntMaxInstruction.html +0 -218
  592. data/doc/classes/IntMaxInstruction.src/M000167.html +0 -15
  593. data/doc/classes/IntMaxInstruction.src/M000168.html +0 -16
  594. data/doc/classes/IntMaxInstruction.src/M000169.html +0 -16
  595. data/doc/classes/IntMaxInstruction.src/M000170.html +0 -15
  596. data/doc/classes/IntMinInstruction.html +0 -218
  597. data/doc/classes/IntMinInstruction.src/M000171.html +0 -15
  598. data/doc/classes/IntMinInstruction.src/M000172.html +0 -16
  599. data/doc/classes/IntMinInstruction.src/M000173.html +0 -16
  600. data/doc/classes/IntMinInstruction.src/M000174.html +0 -15
  601. data/doc/classes/IntModuloInstruction.html +0 -218
  602. data/doc/classes/IntModuloInstruction.src/M000163.html +0 -15
  603. data/doc/classes/IntModuloInstruction.src/M000164.html +0 -16
  604. data/doc/classes/IntModuloInstruction.src/M000165.html +0 -20
  605. data/doc/classes/IntModuloInstruction.src/M000166.html +0 -15
  606. data/doc/classes/IntMultiplyInstruction.html +0 -218
  607. data/doc/classes/IntMultiplyInstruction.src/M000151.html +0 -15
  608. data/doc/classes/IntMultiplyInstruction.src/M000152.html +0 -16
  609. data/doc/classes/IntMultiplyInstruction.src/M000153.html +0 -15
  610. data/doc/classes/IntMultiplyInstruction.src/M000154.html +0 -15
  611. data/doc/classes/IntNegativeInstruction.html +0 -218
  612. data/doc/classes/IntNegativeInstruction.src/M000179.html +0 -15
  613. data/doc/classes/IntNegativeInstruction.src/M000180.html +0 -15
  614. data/doc/classes/IntNegativeInstruction.src/M000181.html +0 -15
  615. data/doc/classes/IntNegativeInstruction.src/M000182.html +0 -15
  616. data/doc/classes/IntPopInstruction.html +0 -218
  617. data/doc/classes/IntPopInstruction.src/M000195.html +0 -15
  618. data/doc/classes/IntPopInstruction.src/M000196.html +0 -15
  619. data/doc/classes/IntPopInstruction.src/M000197.html +0 -14
  620. data/doc/classes/IntPopInstruction.src/M000198.html +0 -14
  621. data/doc/classes/IntRandomInstruction.html +0 -218
  622. data/doc/classes/IntRandomInstruction.src/M000183.html +0 -15
  623. data/doc/classes/IntRandomInstruction.src/M000184.html +0 -14
  624. data/doc/classes/IntRandomInstruction.src/M000185.html +0 -15
  625. data/doc/classes/IntRandomInstruction.src/M000186.html +0 -15
  626. data/doc/classes/IntRotateInstruction.html +0 -218
  627. data/doc/classes/IntRotateInstruction.src/M000207.html +0 -15
  628. data/doc/classes/IntRotateInstruction.src/M000208.html +0 -17
  629. data/doc/classes/IntRotateInstruction.src/M000209.html +0 -14
  630. data/doc/classes/IntRotateInstruction.src/M000210.html +0 -17
  631. data/doc/classes/IntSubtractInstruction.html +0 -218
  632. data/doc/classes/IntSubtractInstruction.src/M000159.html +0 -15
  633. data/doc/classes/IntSubtractInstruction.src/M000160.html +0 -16
  634. data/doc/classes/IntSubtractInstruction.src/M000161.html +0 -16
  635. data/doc/classes/IntSubtractInstruction.src/M000162.html +0 -15
  636. data/doc/classes/IntSwapInstruction.html +0 -218
  637. data/doc/classes/IntSwapInstruction.src/M000199.html +0 -15
  638. data/doc/classes/IntSwapInstruction.src/M000200.html +0 -16
  639. data/doc/classes/IntSwapInstruction.src/M000201.html +0 -14
  640. data/doc/classes/IntSwapInstruction.src/M000202.html +0 -16
  641. data/doc/classes/IntType.html +0 -240
  642. data/doc/classes/IntType.src/M000235.html +0 -15
  643. data/doc/classes/IntType.src/M000236.html +0 -15
  644. data/doc/classes/IntType.src/M000237.html +0 -18
  645. data/doc/classes/IntType.src/M000238.html +0 -15
  646. data/doc/classes/IntType.src/M000239.html +0 -15
  647. data/doc/classes/LiteralNode.html +0 -183
  648. data/doc/classes/LiteralNode.src/M000251.html +0 -15
  649. data/doc/classes/LiteralNode.src/M000252.html +0 -16
  650. data/doc/classes/LiteralNode.src/M000253.html +0 -16
  651. data/doc/classes/Nudge/Channel.html +0 -437
  652. data/doc/classes/Nudge/Channel.src/M000286.html +0 -15
  653. data/doc/classes/Nudge/Channel.src/M000287.html +0 -19
  654. data/doc/classes/Nudge/Channel.src/M000288.html +0 -15
  655. data/doc/classes/Nudge/Channel.src/M000289.html +0 -15
  656. data/doc/classes/Nudge/Channel.src/M000290.html +0 -15
  657. data/doc/classes/Nudge/Channel.src/M000291.html +0 -19
  658. data/doc/classes/Nudge/Channel.src/M000292.html +0 -19
  659. data/doc/classes/Nudge/Channel.src/M000293.html +0 -17
  660. data/doc/classes/Nudge/Channel.src/M000294.html +0 -15
  661. data/doc/classes/Nudge/Channel.src/M000295.html +0 -20
  662. data/doc/classes/Nudge/Channel.src/M000296.html +0 -15
  663. data/doc/classes/Nudge/Channel.src/M000297.html +0 -17
  664. data/doc/classes/Nudge/Channel.src/M000298.html +0 -15
  665. data/doc/classes/Nudge/CodeBlock.html +0 -331
  666. data/doc/classes/Nudge/CodeBlock.src/M000263.html +0 -15
  667. data/doc/classes/Nudge/CodeBlock.src/M000264.html +0 -15
  668. data/doc/classes/Nudge/CodeBlock.src/M000265.html +0 -15
  669. data/doc/classes/Nudge/CodeBlock.src/M000266.html +0 -15
  670. data/doc/classes/Nudge/CodeBlock.src/M000267.html +0 -15
  671. data/doc/classes/Nudge/CodeBlock.src/M000268.html +0 -17
  672. data/doc/classes/Nudge/CodeBlock.src/M000269.html +0 -20
  673. data/doc/classes/Nudge/CodeBlock.src/M000270.html +0 -15
  674. data/doc/classes/Nudge/CodeBlock.src/M000271.html +0 -19
  675. data/doc/classes/Nudge/DeadLocation.html +0 -152
  676. data/doc/classes/Nudge/DeadLocation.src/M000334.html +0 -17
  677. data/doc/classes/Nudge/Erc.html +0 -335
  678. data/doc/classes/Nudge/Erc.src/M000278.html +0 -16
  679. data/doc/classes/Nudge/Erc.src/M000279.html +0 -15
  680. data/doc/classes/Nudge/Erc.src/M000280.html +0 -15
  681. data/doc/classes/Nudge/Erc.src/M000281.html +0 -15
  682. data/doc/classes/Nudge/Erc.src/M000282.html +0 -18
  683. data/doc/classes/Nudge/Erc.src/M000283.html +0 -15
  684. data/doc/classes/Nudge/Erc.src/M000284.html +0 -17
  685. data/doc/classes/Nudge/Erc.src/M000285.html +0 -15
  686. data/doc/classes/Nudge/Individual.html +0 -313
  687. data/doc/classes/Nudge/Individual.src/M000314.html +0 -21
  688. data/doc/classes/Nudge/Individual.src/M000315.html +0 -15
  689. data/doc/classes/Nudge/Individual.src/M000316.html +0 -15
  690. data/doc/classes/Nudge/Individual.src/M000317.html +0 -17
  691. data/doc/classes/Nudge/Individual.src/M000318.html +0 -25
  692. data/doc/classes/Nudge/InstructionPoint/InstructionNotFoundError.html +0 -110
  693. data/doc/classes/Nudge/InstructionPoint.html +0 -350
  694. data/doc/classes/Nudge/InstructionPoint.src/M000299.html +0 -15
  695. data/doc/classes/Nudge/InstructionPoint.src/M000300.html +0 -15
  696. data/doc/classes/Nudge/InstructionPoint.src/M000301.html +0 -17
  697. data/doc/classes/Nudge/InstructionPoint.src/M000302.html +0 -15
  698. data/doc/classes/Nudge/InstructionPoint.src/M000303.html +0 -17
  699. data/doc/classes/Nudge/InstructionPoint.src/M000304.html +0 -17
  700. data/doc/classes/Nudge/InstructionPoint.src/M000305.html +0 -17
  701. data/doc/classes/Nudge/InstructionPoint.src/M000306.html +0 -15
  702. data/doc/classes/Nudge/Interpreter.html +0 -369
  703. data/doc/classes/Nudge/Interpreter.src/M000257.html +0 -20
  704. data/doc/classes/Nudge/Interpreter.src/M000258.html +0 -19
  705. data/doc/classes/Nudge/Interpreter.src/M000259.html +0 -15
  706. data/doc/classes/Nudge/Interpreter.src/M000260.html +0 -19
  707. data/doc/classes/Nudge/Interpreter.src/M000261.html +0 -17
  708. data/doc/classes/Nudge/LiteralPoint.html +0 -291
  709. data/doc/classes/Nudge/LiteralPoint.src/M000272.html +0 -16
  710. data/doc/classes/Nudge/LiteralPoint.src/M000273.html +0 -15
  711. data/doc/classes/Nudge/LiteralPoint.src/M000274.html +0 -15
  712. data/doc/classes/Nudge/LiteralPoint.src/M000275.html +0 -18
  713. data/doc/classes/Nudge/LiteralPoint.src/M000276.html +0 -17
  714. data/doc/classes/Nudge/LiteralPoint.src/M000277.html +0 -15
  715. data/doc/classes/Nudge/Location.html +0 -525
  716. data/doc/classes/Nudge/Location.src/M000319.html +0 -19
  717. data/doc/classes/Nudge/Location.src/M000320.html +0 -15
  718. data/doc/classes/Nudge/Location.src/M000321.html +0 -26
  719. data/doc/classes/Nudge/Location.src/M000322.html +0 -15
  720. data/doc/classes/Nudge/Location.src/M000323.html +0 -20
  721. data/doc/classes/Nudge/Location.src/M000324.html +0 -16
  722. data/doc/classes/Nudge/Location.src/M000325.html +0 -25
  723. data/doc/classes/Nudge/Location.src/M000326.html +0 -15
  724. data/doc/classes/Nudge/Location.src/M000327.html +0 -21
  725. data/doc/classes/Nudge/Location.src/M000328.html +0 -16
  726. data/doc/classes/Nudge/Location.src/M000329.html +0 -15
  727. data/doc/classes/Nudge/Location.src/M000330.html +0 -16
  728. data/doc/classes/Nudge/Location.src/M000331.html +0 -20
  729. data/doc/classes/Nudge/Location.src/M000332.html +0 -17
  730. data/doc/classes/Nudge/Location.src/M000333.html +0 -17
  731. data/doc/classes/Nudge/NondominatedSubset.html +0 -196
  732. data/doc/classes/Nudge/NondominatedSubset.src/M000005.html +0 -19
  733. data/doc/classes/Nudge/NondominatedSubset.src/M000006.html +0 -19
  734. data/doc/classes/Nudge/NondominatedSubset.src/M000007.html +0 -25
  735. data/doc/classes/Nudge/NondominatedSubset.src/M000339.html +0 -19
  736. data/doc/classes/Nudge/NondominatedSubset.src/M000340.html +0 -19
  737. data/doc/classes/Nudge/NondominatedSubset.src/M000341.html +0 -25
  738. data/doc/classes/Nudge/PopulationResample.html +0 -175
  739. data/doc/classes/Nudge/PopulationResample.src/M000003.html +0 -22
  740. data/doc/classes/Nudge/PopulationResample.src/M000337.html +0 -22
  741. data/doc/classes/Nudge/ProgramPoint.html +0 -148
  742. data/doc/classes/Nudge/ProgramPoint.src/M000262.html +0 -15
  743. data/doc/classes/Nudge/RandomGuess.html +0 -176
  744. data/doc/classes/Nudge/RandomGuess.src/M000002.html +0 -21
  745. data/doc/classes/Nudge/RandomGuess.src/M000336.html +0 -21
  746. data/doc/classes/Nudge/ResampleValues.html +0 -169
  747. data/doc/classes/Nudge/ResampleValues.src/M000004.html +0 -36
  748. data/doc/classes/Nudge/ResampleValues.src/M000338.html +0 -36
  749. data/doc/classes/Nudge/SearchOperator.html +0 -175
  750. data/doc/classes/Nudge/SearchOperator.src/M000001.html +0 -15
  751. data/doc/classes/Nudge/SearchOperator.src/M000335.html +0 -15
  752. data/doc/classes/Nudge/Stack.html +0 -350
  753. data/doc/classes/Nudge/Stack.src/M000307.html +0 -15
  754. data/doc/classes/Nudge/Stack.src/M000308.html +0 -15
  755. data/doc/classes/Nudge/Stack.src/M000309.html +0 -18
  756. data/doc/classes/Nudge/Stack.src/M000310.html +0 -15
  757. data/doc/classes/Nudge/Stack.src/M000311.html +0 -15
  758. data/doc/classes/Nudge/Stack.src/M000312.html +0 -15
  759. data/doc/classes/Nudge/Stack.src/M000313.html +0 -15
  760. data/doc/classes/Nudge/UniformBackboneCrossover.html +0 -152
  761. data/doc/classes/Nudge/UniformBackboneCrossover.src/M000008.html +0 -35
  762. data/doc/classes/Nudge/UniformBackboneCrossover.src/M000342.html +0 -35
  763. data/doc/classes/Nudge.html +0 -174
  764. data/doc/classes/NudgeType.html +0 -363
  765. data/doc/classes/NudgeType.src/M000225.html +0 -17
  766. data/doc/classes/NudgeType.src/M000226.html +0 -15
  767. data/doc/classes/NudgeType.src/M000227.html +0 -15
  768. data/doc/classes/NudgeType.src/M000228.html +0 -15
  769. data/doc/classes/NudgeType.src/M000229.html +0 -15
  770. data/doc/classes/NudgeType.src/M000230.html +0 -15
  771. data/doc/classes/NudgeType.src/M000231.html +0 -15
  772. data/doc/classes/NudgeType.src/M000232.html +0 -15
  773. data/doc/classes/NudgeType.src/M000233.html +0 -15
  774. data/doc/classes/NudgeType.src/M000234.html +0 -15
  775. data/doc/created.rid +0 -1
  776. data/doc/files/lib/instructions/bool_basics_rb.html +0 -90
  777. data/doc/files/lib/instructions/comparisons_rb.html +0 -90
  778. data/doc/files/lib/instructions/conditionals_rb.html +0 -90
  779. data/doc/files/lib/instructions/conversions_rb.html +0 -90
  780. data/doc/files/lib/instructions/exec_rb.html +0 -90
  781. data/doc/files/lib/instructions/float_arithmetic_rb.html +0 -90
  782. data/doc/files/lib/instructions/float_transcendental_rb.html +0 -90
  783. data/doc/files/lib/instructions/infrastructure_rb.html +0 -100
  784. data/doc/files/lib/instructions/int_arithmetic_rb.html +0 -90
  785. data/doc/files/lib/instructions/random_value_rb.html +0 -90
  786. data/doc/files/lib/instructions/stack_manipulation_rb.html +0 -90
  787. data/doc/files/lib/interpreter/grammars/nudge_language_helpers_rb.html +0 -97
  788. data/doc/files/lib/interpreter/grammars/nudge_language_treetop.html +0 -180
  789. data/doc/files/lib/interpreter/interpreter_rb.html +0 -90
  790. data/doc/files/lib/interpreter/programPoints_rb.html +0 -90
  791. data/doc/files/lib/interpreter/stack_rb.html +0 -90
  792. data/doc/files/lib/interpreter/types/codeType_rb.html +0 -157
  793. data/doc/files/lib/interpreter/types/codeType_rb.src/M000001.html +0 -15
  794. data/doc/files/lib/interpreter/types/codeType_rb.src/M000002.html +0 -15
  795. data/doc/files/lib/interpreter/types/pushTypes_rb.html +0 -107
  796. data/doc/files/lib/nudge_rb.html +0 -152
  797. data/doc/files/lib/search/evaluators/structural_complexity_rb.html +0 -90
  798. data/doc/files/lib/search/helpers_rb.html +0 -90
  799. data/doc/files/lib/search/individual/individual_rb.html +0 -90
  800. data/doc/files/lib/search/locations/location_rb.html +0 -100
  801. data/doc/files/lib/search/operators/basic_operators_rb.html +0 -90
  802. data/doc/fr_class_index.html +0 -191
  803. data/doc/fr_file_index.html +0 -71
  804. data/doc/fr_method_index.html +0 -711
  805. data/doc/index.html +0 -21
  806. data/doc/rdoc-style.css +0 -299
  807. data/features/parser_recognizes_nudge_language.feature +0 -9
  808. data/lib/instructions/bool_basics.rb +0 -85
  809. data/lib/instructions/comparisons.rb +0 -152
  810. data/lib/instructions/conditionals.rb +0 -44
  811. data/lib/instructions/conversions.rb +0 -94
  812. data/lib/instructions/exec.rb +0 -154
  813. data/lib/instructions/float_arithmetic.rb +0 -201
  814. data/lib/instructions/float_transcendental.rb +0 -47
  815. data/lib/instructions/int_arithmetic.rb +0 -160
  816. data/lib/instructions/name_basics.rb +0 -44
  817. data/lib/instructions/name_bindings.rb +0 -65
  818. data/lib/instructions/random_value.rb +0 -43
  819. data/lib/instructions/stack_manipulation.rb +0 -739
  820. data/lib/interpreter/grammars/nudge_language.treetop +0 -83
  821. data/lib/interpreter/grammars/nudge_language_helpers.rb +0 -64
  822. data/lib/search/experiments/experiment.rb +0 -53
  823. data/lib/search/helpers.rb +0 -22
  824. data/lib/search/individual/batch.rb +0 -25
  825. data/lib/search/individual/individual.rb +0 -145
  826. data/lib/search/operators/basic_operators.rb +0 -230
  827. data/lib/search/operators/evaluators.rb +0 -107
  828. data/lib/search/operators/samplers_and_selectors.rb +0 -123
  829. data/lib/search/stations/station.rb +0 -147
  830. data/nudge.gemspec +0 -706
  831. data/push_language_coverage.md +0 -177
  832. data/script/console +0 -10
  833. data/script/destroy +0 -14
  834. data/script/generate +0 -14
  835. data/spec/data/couchdb_spec.rb +0 -2
  836. data/spec/instructions/bool_basics_spec.rb +0 -97
  837. data/spec/instructions/bool_stack_spec.rb +0 -391
  838. data/spec/instructions/code_basics_spec.rb +0 -43
  839. data/spec/instructions/code_stack_spec.rb +0 -382
  840. data/spec/instructions/comparisons_spec.rb +0 -486
  841. data/spec/instructions/conditionals_spec.rb +0 -162
  842. data/spec/instructions/conversions_spec.rb +0 -92
  843. data/spec/instructions/exec_spec.rb +0 -883
  844. data/spec/instructions/float_calculations_spec.rb +0 -148
  845. data/spec/instructions/float_stack_spec.rb +0 -382
  846. data/spec/instructions/float_transcendental_spec.rb +0 -89
  847. data/spec/instructions/int_calculations_spec.rb +0 -125
  848. data/spec/instructions/int_stack_spec.rb +0 -398
  849. data/spec/instructions/name_basics_spec.rb +0 -158
  850. data/spec/instructions/name_bindings_spec.rb +0 -257
  851. data/spec/instructions/name_stack_spec.rb +0 -382
  852. data/spec/instructions/random_values_spec.rb +0 -68
  853. data/spec/integration/search_integration.rb +0 -67
  854. data/spec/interpreter/channel_spec.rb +0 -92
  855. data/spec/interpreter/codeblock_spec.rb +0 -135
  856. data/spec/interpreter/erc_spec.rb +0 -130
  857. data/spec/interpreter/literal_spec.rb +0 -94
  858. data/spec/interpreter/parser_spec.rb +0 -324
  859. data/spec/search/batch_spec.rb +0 -30
  860. data/spec/search/experiments/experiment_spec.rb +0 -101
  861. data/spec/search/helpers_spec.rb +0 -59
  862. data/spec/search/individual_spec.rb +0 -356
  863. data/spec/search/operators/any_one_sampler_spec.rb +0 -40
  864. data/spec/search/operators/dominated_quantile_spec.rb +0 -111
  865. data/spec/search/operators/duplicate_genomes_spec.rb +0 -35
  866. data/spec/search/operators/evaluators/program_point_evaluator_spec.rb +0 -43
  867. data/spec/search/operators/evaluators/test_case_evaluator_spec.rb +0 -133
  868. data/spec/search/operators/infrastructure_spec.rb +0 -47
  869. data/spec/search/operators/most_dominated_subset_spec.rb +0 -47
  870. data/spec/search/operators/nondominated_subset_spec.rb +0 -97
  871. data/spec/search/operators/pointCrossover_spec.rb +0 -55
  872. data/spec/search/operators/pointDeletion_spec.rb +0 -57
  873. data/spec/search/operators/pointMutation_spec.rb +0 -71
  874. data/spec/search/operators/random_guess_spec.rb +0 -51
  875. data/spec/search/operators/resample_and_clone_spec.rb +0 -50
  876. data/spec/search/operators/resample_values_spec.rb +0 -126
  877. data/spec/search/operators/sizePreservingMutation_spec.rb +0 -2
  878. data/spec/search/operators/uniformBackboneCrossover_spec.rb +0 -63
  879. data/spec/search/stations/station_spec.rb +0 -496
  880. data/test/test_generator_helper.rb +0 -29
  881. data/test/test_nudge_generator.rb +0 -43
  882. /data/lib/instructions/{code_basics.rb → code/code_noop.rb} +0 -0
  883. /data/{_spikes/nested_parsing/nested.rb → spec/support/shared_examples.rb} +0 -0
@@ -0,0 +1,774 @@
1
+ #encoding: utf-8
2
+ require File.join(File.dirname(__FILE__), "./../spec_helper")
3
+ load_grammar('codeblock')
4
+ include Nudge
5
+
6
+
7
+ describe "Nudge Program parsing" do
8
+ before(:each) do
9
+ @parser = NudgeCodeblockParser.new()
10
+ end
11
+
12
+ describe ": initializing a new NudgeProgram from a string" do
13
+ it "should check that it's been given a string" do
14
+ lambda{NudgeProgram.new(2)}.should raise_error(
15
+ ArgumentError, "NudgeProgram.new should be passed a string")
16
+ end
17
+
18
+ it "should keep the original string in #raw_code" do
19
+ NudgeProgram.new("I'm a little teacup").raw_code.should == "I'm a little teacup"
20
+ end
21
+
22
+ it "should be possible to initialize it with an empty string" do
23
+ lambda{NudgeProgram.new("")}.should_not raise_error
24
+ NudgeProgram.new("").blueprint.should == ""
25
+ end
26
+ end
27
+
28
+ describe ": parser should first break up programs into codeblock and footnotes" do
29
+ describe "separating out the codeblock" do
30
+ it "should read the codeblock into #code_section" do
31
+ NudgeProgram.new("do int_add").code_section.should == "do int_add"
32
+ NudgeProgram.new("block {}").code_section.should == "block {}"
33
+
34
+ NudgeProgram.new("value «int» \n«int» 8").code_section.should == "value «int»"
35
+ NudgeProgram.new("block {value «int» ref x2}\n \n«int» 8").code_section.should ==
36
+ "block {value «int» ref x2}"
37
+ end
38
+ end
39
+
40
+ describe ": capturing and preparing the footnotes" do
41
+ it "should capture the footnote code into #footnote_section" do
42
+ NudgeProgram.new("do int_add").footnote_section.should == ""
43
+ NudgeProgram.new("block {}\n\n").footnote_section.should == ""
44
+
45
+ NudgeProgram.new("value «int» \n«int» 8").footnote_section.should == "«int» 8"
46
+ NudgeProgram.new("value «int» \n«int» 8 \n«code» value «bool»").footnote_section.should ==
47
+ "«int» 8 \n«code» value «bool»"
48
+ end
49
+
50
+ it "should capture each individual footnote into #footnotes" do
51
+ NudgeProgram.new("do int_add").footnotes.should == {}
52
+ NudgeProgram.new("value «int» \n«bool» false").footnotes[:bool].should include("false")
53
+
54
+ tricky = NudgeProgram.new("value «int» \n«int» 8 \n«code» value «bool»").footnotes
55
+ tricky.keys.length.should == 2
56
+ tricky[:code].should == ["value «bool»"]
57
+ end
58
+ end
59
+
60
+ describe ": trimming whitespace from footnote values" do
61
+ it "should ignore leading whitespace" do
62
+ NudgeProgram.new("value «baz» \n«baz»\t\t8").tokenized_footnote_section[:baz][0].should == "8"
63
+ NudgeProgram.new("value «baz» \n«baz»\n\n\n\n8").tokenized_footnote_section[:baz][0].should == "8"
64
+ NudgeProgram.new("value «baz» \n«baz» 8").tokenized_footnote_section[:baz][0].should == "8"
65
+ NudgeProgram.new("value «baz» \n«baz»8").tokenized_footnote_section[:baz][0].should == "8"
66
+ end
67
+
68
+ it "should should ignore trailing whitespace" do
69
+ NudgeProgram.new("value «foo» \n«foo» 9\t\t").tokenized_footnote_section[:foo][0].should == "9"
70
+ NudgeProgram.new("value «foo» \n«foo» 9\n\n\n\n").tokenized_footnote_section[:foo][0].should == "9"
71
+ NudgeProgram.new("value «foo» \n«foo» 9 ").tokenized_footnote_section[:foo][0].should == "9"
72
+ end
73
+
74
+ it "should capture whitespace inside values" do
75
+ NudgeProgram.new("value «bar» \n«bar» 9\t\t9").tokenized_footnote_section[:bar][0].should == "9\t\t9"
76
+ NudgeProgram.new("value «bar» \n«bar» 9\n\n\n\n9").tokenized_footnote_section[:bar][0].
77
+ should == "9\n\n\n\n9"
78
+ NudgeProgram.new("value «bar» \n«bar» 9 9").tokenized_footnote_section[:bar][0].should == "9 9"
79
+ end
80
+
81
+ it "should trim whitespace between footnotes" do
82
+ NudgeProgram.new("value «bar» \n«bar» 9\n \n\t\n«baz»9").
83
+ tokenized_footnote_section.keys.length.should == 2
84
+ NudgeProgram.new("value «bar» \n«bar» 9\n \n\t\n«baz»9").
85
+ tokenized_footnote_section.keys.should include(:bar)
86
+ NudgeProgram.new("value «bar» \n«bar» 9\n \n\t\n«baz»9").
87
+ tokenized_footnote_section.keys.should include(:baz)
88
+ end
89
+
90
+ it "should avoid capturing newlines between footnotes" do
91
+ known_risk = NudgeProgram.new("block {value «mya»\nvalue «myb»}\n«myb» this is a b\n«mya» a")
92
+ known_risk.tokenized_footnote_section[:myb][0].should == "this is a b"
93
+ end
94
+ end
95
+ end
96
+
97
+
98
+ describe ": code_section methods" do
99
+ it "should have a #parses? method that returns true iff the code_section is valid" do
100
+ NudgeProgram.new("do int_add").parses?.should == true
101
+ NudgeProgram.new("block {}").parses?.should == true
102
+ NudgeProgram.new("dofoo baz doo runrun").parses?.should == false
103
+ NudgeProgram.new("").parses?.should == false
104
+
105
+ NudgeProgram.new("value «bar» \n«bar» 9 9").parses?.should == true
106
+ NudgeProgram.new("block {} «bar» 9 9").parses?.should == false
107
+ end
108
+
109
+ describe ": should have a #tidy attribute with the indented, one-point per line structure" do
110
+ it "should work for one-line programs" do
111
+ NudgeProgram.new("do int_add").tidy.should == "do int_add"
112
+ NudgeProgram.new("ref x4").tidy.should == "ref x4"
113
+ NudgeProgram.new("value \t\t «golly»").tidy.should == "value «golly»"
114
+ NudgeProgram.new("block {}").tidy.should == "block {}"
115
+ end
116
+
117
+ it "should produce 2-space indents for nested program points" do
118
+ NudgeProgram.new("block { ref \t x1}").tidy.should == "block {\n ref x1}"
119
+ NudgeProgram.new("block { do a do b do c}").tidy.should == "block {\n do a\n do b\n do c}"
120
+ end
121
+
122
+ it "should outdent after the close of a nested block" do
123
+ flat = "block { block { ref a } value «gah»}"
124
+ liney = "block {\n block {\n ref a}\n value «gah»}"
125
+ NudgeProgram.new(flat).tidy.should == liney
126
+ end
127
+
128
+ it "should produce an empty string if called on a bad program" do
129
+ NudgeProgram.new("nobody home boss «k2» •¡ß").tidy.should == ""
130
+ end
131
+
132
+ it "should work for really big programs" do
133
+ jeez = "block {" + ("block { " * 20 + "block {}" + "}" * 20) * 3 + "}"
134
+ NudgeProgram.new(jeez).tidy.split(/\n/).length.should == 64
135
+ end
136
+ end
137
+ end
138
+
139
+
140
+ describe "linked_code should contain the abstract syntax tree, plus associated_values" do
141
+ it "should be a simple one-node tree for one-line code" do
142
+ NudgeProgram.new("ref time").linked_code.should be_a_kind_of(ReferencePoint)
143
+ NudgeProgram.new("do my_thing").linked_code.should be_a_kind_of(InstructionPoint)
144
+ NudgeProgram.new("block {}").linked_code.should be_a_kind_of(CodeblockPoint)
145
+ NudgeProgram.new("value «idjit»").linked_code.should be_a_kind_of(ValuePoint)
146
+ end
147
+
148
+ it "should return a NilPoint if the code can't be interpreted" do
149
+ NudgeProgram.new("some random junk that ain't a program").linked_code.should be_a_kind_of(NilPoint)
150
+ end
151
+
152
+ it "should be a CodeblockPoint with #contents set appropriately if it's a multiline program" do
153
+ lt = NudgeProgram.new("block {ref a\nref b}")
154
+ lt.linked_code.should be_a_kind_of(CodeblockPoint)
155
+ lt.linked_code.contents.length.should == 2
156
+ lt.linked_code.contents[0].should be_a_kind_of(ReferencePoint)
157
+ lt.linked_code.contents[1].name.should == "b"
158
+
159
+ bbb = NudgeProgram.new("block { block { block {}}}")
160
+ bbb.linked_code.should be_a_kind_of(CodeblockPoint)
161
+ bbb.linked_code.contents.length.should == 1
162
+ bbb.linked_code.contents[0].contents[0].should be_a_kind_of(CodeblockPoint)
163
+ bbb.linked_code.contents[0].contents[0].contents.should == []
164
+ end
165
+ end
166
+
167
+
168
+ describe "#contains_codevalues? method" do
169
+ it "should return true iff the raw code (including footnote_section) includes 'value «code»" do
170
+ NudgeProgram.new("do int_add").contains_codevalues?.should == false
171
+ NudgeProgram.new("value \t\t«code»").contains_codevalues?.should == true
172
+ NudgeProgram.new("block {block {value \n «code»}}").contains_codevalues?.should == true
173
+ end
174
+ end
175
+
176
+
177
+ # some examples worked by hand to test the
178
+ # depth-first association of values to footnotes
179
+ #
180
+ # @nasty: | associated values:
181
+ # ------------- | ------------------
182
+ # block { |
183
+ # value «code» | <- "value «foo»\n«foo» 1"
184
+ # value «code» | <- "block {value «code»}\n«code» value «foo»\n«foo» 2"
185
+ # value «foo»} | <- "3"
186
+ # «code» value «foo» |
187
+ # «code» block {value «code»}
188
+ # «foo» 1 |
189
+ # «foo» 2 |
190
+ # «code» value «foo» |
191
+ # «foo» 3 |
192
+ # |
193
+ # |
194
+ # @boring: | associated values:
195
+ # ------------- | ------------------
196
+ # block { |
197
+ # value «code»} | <- "value «int»\n«int» 2"
198
+ # «code» value «int» |
199
+ # «int» 2 |
200
+ # |
201
+ # |
202
+ # @hofstadter1: | associated values:
203
+ # ------------- | ------------------
204
+ # block { |
205
+ # value «int» | <- "2"
206
+ # value «code» | <- "value «code»\n«code» value «int»\n«int» 33"
207
+ # value «int»} | <- "444"
208
+ # «int» 2 |
209
+ # «int» 33 |
210
+ # «code» value «code» |
211
+ # «int» 444 |
212
+ # «code» value «int» |
213
+
214
+
215
+ describe "keep footnote values associated with proper program point Nodes" do
216
+ it "should set the #value attribute of a ValuePoint" do
217
+ simple = NudgeProgram.new("value «int» \n«int» 0")
218
+ simple.linked_code.should be_a_kind_of(ValuePoint)
219
+ simple.linked_code.raw.should == "0"
220
+ end
221
+
222
+ it "should set the value attribute even in a deeply nested statement" do
223
+ deep = NudgeProgram.new("block { block { block {} block {value «int»}}} \n«int» 0")
224
+ deep.linked_code.contents[0].contents[1].contents[0].raw.should == "0"
225
+ end
226
+
227
+ it "should map values correctly based on the type strings" do
228
+ swapped = NudgeProgram.new("block {value «my_a»\nvalue «my_b»}\n«my_b» this is a b\n«my_a» a")
229
+ swapped.linked_code.contents[0].raw.should == "a"
230
+ swapped.linked_code.contents[1].raw.should == "this is a b"
231
+ end
232
+
233
+ it "should associate values in the order they appear" do
234
+ swapped = NudgeProgram.new("block {value «my_a»\nvalue «my_a»}\n«my_a» one\n«my_a» two")
235
+ swapped.linked_code.contents[0].raw.should == "one"
236
+ swapped.linked_code.contents[1].raw.should == "two"
237
+ end
238
+
239
+ it "should leave nil values if it runs out of footnotes" do
240
+ simple = NudgeProgram.new("value «int»")
241
+ simple.linked_code.should be_a_kind_of(ValuePoint)
242
+ simple.linked_code.value.should == nil
243
+ end
244
+
245
+ describe "blueprint" do
246
+ it "should produce the same thing as #tidy for a ReferencePoint program" do
247
+ justrp = NudgeProgram.new("ref g8")
248
+ justrp.blueprint.should == "ref g8"
249
+ end
250
+
251
+ it "should produce the same thing as #tidy for an InstructionPoint program" do
252
+ justrp = NudgeProgram.new("do my_word")
253
+ justrp.blueprint.should == "do my_word"
254
+ end
255
+
256
+ it "should produce the same thing as #tidy for a CodeblockPoint program without footnotes" do
257
+ tree1 = NudgeProgram.new("block {\t\t ref g}")
258
+ tree1.blueprint.should == "block {\n ref g}"
259
+ tree2 = NudgeProgram.new("block {\t\t do a\ndo b\n \n do c\n do d}")
260
+ tree2.blueprint.should == tree2.tidy
261
+ end
262
+
263
+ it "should produce the same thing as #tidy for a CodeblockPoint program with unassigned footnotes" do
264
+ dangling = NudgeProgram.new("block {\t\t value «a»\nvalue «b»\n \n value «c»}")
265
+ dangling.blueprint.should == dangling.tidy
266
+ end
267
+
268
+ it "should put out the tidy form AND the footnotes in the right order" do
269
+ withfn = NudgeProgram.new("value \t\t«int» \n«int» \t\t\n 0")
270
+ withfn.blueprint.should == "value «int» \n«int» 0"
271
+
272
+ nasty = "block {value «code» \nvalue «code» \nvalue «foo»}\n«code» value «foo»\n«code» block {value «code»}\n«foo» 1\n«foo» 2\n«code» value «foo»\n«foo» 3"
273
+ once_around = NudgeProgram.new(nasty).blueprint
274
+ once_around.should == NudgeProgram.new(once_around).blueprint
275
+ end
276
+ end
277
+
278
+ describe "handling complex nested CODE values is hard!" do
279
+ before(:each) do
280
+ @hofstadter1 = <<-END
281
+ block { value «int» value «code» value «int»}
282
+ «int» 2
283
+ «int» 33
284
+ «code» value «code»
285
+ «int» 444
286
+ «code» value «int»
287
+ END
288
+ end
289
+
290
+ it "should associate values in a depth-first way (into «code» values)" do
291
+ we_think = NudgeProgram.new(@hofstadter1)
292
+ we_think.contains_codevalues?.should == true
293
+ we_think.tidy.should == "block {\n value «int»\n value «code»\n value «int»}"
294
+ we_think.linked_code.contents[0].raw.should == "2"
295
+ we_think.linked_code.contents[1].raw.should ==
296
+ "value «code»\n«code» value «int»\n«int» 33"
297
+ we_think.linked_code.contents[2].raw.should == "444"
298
+ we_think.blueprint.should ==
299
+ "block {\n value «int»\n value «code»\n value «int»} " +
300
+ "\n«int» 2\n«code» value «code»\n«code» value «int»\n«int» 33\n«int» 444"
301
+ end
302
+ end
303
+
304
+ end
305
+
306
+ describe "contains_valuepoints?" do
307
+ it "should accept a string and return true if it contains any «» markup AT ALL" do
308
+ np = NudgeProgram.new("")
309
+ np.contains_valuepoints?("value «foo»").should == true
310
+ np.contains_valuepoints?("block {value «foo_3»}").should == true
311
+ np.contains_valuepoints?("value «a»").should == true
312
+ np.contains_valuepoints?("««»»").should == false
313
+ np.contains_valuepoints?("boring old crap").should == false
314
+ np.contains_valuepoints?("misleading «something»").should == false
315
+ end
316
+ end
317
+
318
+
319
+ describe "pursue_more_footnotes method" do
320
+ before(:each) do
321
+ @nasty = "block {value «code» \nvalue «code» \nvalue «foo»}\n«code» value «foo»\n«code» block {value «code»}\n«foo» 1\n«foo» 2\n«code» value «foo»\n«foo» 3"
322
+ @simple = "block {value «code»}\n«code» value «int»\n«int» 2"
323
+ @boring = "value «code»\n«code» block {}"
324
+ @stringy = "value «code»\n«code» value «code»\n«code» value «code»\n«code» do X"
325
+ @filler = '['+ (" \n "*100) + ']'
326
+ @spacey = "value «code»\n«code» value «spacer»\n«spacer»#{@filler}"
327
+ @staged_program = NudgeProgram.new("")
328
+
329
+ def reprocess_using(new_code)
330
+ @staged_program.instance_variable_set(:@raw_code,new_code)
331
+ @staged_program.program_split!
332
+ @staged_program.relink_code!
333
+ end
334
+ end
335
+
336
+ it "should determine if the blueprint contains any ValuePoints if it is type code" do
337
+ @staged_program.should_receive(:contains_valuepoints?).with("block {}")
338
+ reprocess_using(@boring)
339
+ end
340
+
341
+ it "should (in the end) return the collected_footnotes string for this depth-first traversal" do
342
+ reprocess_using(@nasty)
343
+ @staged_program.linked_code.contents[0].raw.should == "value «foo»\n«foo» 1"
344
+ @staged_program.linked_code.contents[1].raw.should ==
345
+ "block {value «code»}\n«code» value «foo»\n«foo» 2"
346
+ @staged_program.linked_code.contents[2].raw.should == "3"
347
+
348
+ reprocess_using(@simple)
349
+ @staged_program.linked_code.contents[0].raw.should == "value «int»\n«int» 2"
350
+
351
+ reprocess_using(@boring)
352
+ @staged_program.linked_code.raw.should == "block {}"
353
+
354
+ reprocess_using(@stringy)
355
+ @staged_program.linked_code.raw.should == "value «code»\n«code» value «code»\n«code» do X"
356
+
357
+ reprocess_using(@spacey)
358
+ @staged_program.linked_code.raw.should == "value «spacer»\n«spacer» #{@filler}"
359
+ end
360
+ end
361
+
362
+
363
+ describe "preserving unused footnotes" do
364
+ before(:each) do
365
+ @all_extras = "value «foo»\n«bar» baz\n«qux» nothing"
366
+ @all_used = "value «foo»\n«foo» bar"
367
+
368
+ end
369
+ it "should collect unused footnote strings in an Array called #unused_footnotes" do
370
+ NudgeProgram.new(@all_extras).unused_footnotes.should include("«bar» baz")
371
+ NudgeProgram.new(@all_extras).unused_footnotes.should include("«qux» nothing")
372
+
373
+ NudgeProgram.new(@all_used).unused_footnotes.should be_empty
374
+ end
375
+
376
+ it "should preserve the unused footnotes at the end of #blueprint" do
377
+ NudgeProgram.new(@all_extras).blueprint.should include("«bar» baz")
378
+ end
379
+ end
380
+
381
+
382
+
383
+ describe ": handling malformed programs" do
384
+ it "should interpret an empty string as no code at all" do
385
+ huh = NudgeProgram.new("")
386
+ huh.code_section.should == ""
387
+ huh.linked_code.should be_a_kind_of(NilPoint)
388
+ huh.footnote_section.should == ""
389
+ huh.footnotes.should == {} # they didn't get used
390
+ end
391
+
392
+ it "should interpret an unparseable codesection as no code at all, but keep the footnotes" do
393
+ got_nuthin = NudgeProgram.new("block { hunh \n«int» 2")
394
+ got_nuthin.code_section.should == "block { hunh"
395
+ got_nuthin.linked_code.should be_a_kind_of(NilPoint)
396
+ got_nuthin.footnote_section.should == "«int» 2"
397
+ got_nuthin.footnotes.should == {:int => ["2"]} # it's not been used
398
+ end
399
+
400
+
401
+ it "should read values linking to missing footnotes as linked to 'nil'" do
402
+ # nasty_shorter: | associated values:
403
+ # ------------- | ------------------
404
+ # block { |
405
+ # value «code» | <- "value «foo»\n«foo» 1"
406
+ # value «code» | <- "block {value «code»}"
407
+ # value «foo»} | <- nil
408
+ # «code» value «foo» |
409
+ # «code» block {value «code»}
410
+ # «foo» 1 |
411
+
412
+ nasty_shorter = "block {value «code» \nvalue «code» \nvalue «foo»}\n«code» value «foo»\n«code» block {value «code»}\n«foo» 1"
413
+ shortstop = NudgeProgram.new(nasty_shorter)
414
+ shortstop.linked_code.contents[0].raw.should == "value «foo»\n«foo» 1"
415
+ shortstop.linked_code.contents[1].raw.should == "block {value «code»}"
416
+ shortstop.linked_code.contents[2].raw.should == nil
417
+ end
418
+
419
+ it "should collect unused footnotes" do
420
+ hmm = NudgeProgram.new("do int_add\n«nob» nothing")
421
+ hmm.footnotes[:nob].should include("nothing")
422
+ end
423
+
424
+ it "should act as specified above when one or more footnote is unparseable" do
425
+ # stupid_shorter: | associated values:
426
+ # ------------- | ------------------
427
+ # block { |
428
+ # value «code» | <- "value «foo»\n«foo» 1"
429
+ # value «code» | <- "some junk"
430
+ # value «foo»} | <- nil
431
+ # «code» value «foo» |
432
+ # «code» some junk |
433
+ # «foo» 1 |
434
+
435
+ stupid_shorter = "block {value «code» \nvalue «code» \nvalue «foo»}\n«code» value «foo»\n«code» some junk\n«foo» 1"
436
+ busted = NudgeProgram.new(stupid_shorter)
437
+ busted.linked_code.contents[0].raw.should == "value «foo»\n«foo» 1"
438
+ busted.linked_code.contents[1].raw.should == "some junk"
439
+ busted.linked_code.contents[2].raw.should == nil
440
+
441
+ end
442
+ end
443
+
444
+
445
+ describe "maintaining integrity through parsing and blueprint cycles" do
446
+ before(:each) do
447
+ @extras = "block {\nvalue «code»\nvalue «code»\nvalue «foo»}\n«code» value «foo»\n«code» block {value «code»}\n«foo» 1\n«foo» 2\n«code» value «foo»\n«foo» 3\n«bar» baz"
448
+ end
449
+
450
+ it "should have all the same footnotes it started with" do
451
+ original_fn = @extras.partition( /^(?=«)/ )[2].split( /^(?=«)/ ).collect {|fn| fn.strip}
452
+ new_fn = NudgeProgram.new(@extras).blueprint.partition( /^(?=«)/ )[2].
453
+ split( /^(?=«)/ ).collect {|fn| fn.strip}
454
+
455
+ # original_fn.length.should == new_fn.length
456
+ original_fn.sort.should == new_fn.sort
457
+ end
458
+ end
459
+
460
+
461
+ describe "[] method" do
462
+ before(:each) do
463
+ @bigger_tree = "block { value «code» value «int»}\n«int»1\n«code» value «int»\n«int» 2"
464
+ end
465
+
466
+ it "should raise an ArgumentError if the index is 0 or less" do
467
+ lambda{NudgeProgram.new("block {}")[-2]}.should raise_error(ArgumentError)
468
+ lambda{NudgeProgram.new("block {}")[0]}.should raise_error(ArgumentError)
469
+ lambda{NudgeProgram.new("block {}")[1]}.should_not raise_error(ArgumentError)
470
+ end
471
+
472
+ it "should raise an ArgumentError if the index is more than self.points" do
473
+ lambda{NudgeProgram.new("block {}")[4]}.should raise_error(ArgumentError)
474
+ lambda{NudgeProgram.new("block {}")[2]}.should raise_error(ArgumentError)
475
+ lambda{NudgeProgram.new("block {}")[1]}.should_not raise_error(ArgumentError)
476
+ end
477
+
478
+ it "should return a single numbered point of the #linked_code tree" do
479
+ NudgeProgram.new(@bigger_tree)[1].should be_a_kind_of(ProgramPoint)
480
+ NudgeProgram.new(@bigger_tree)[3].should be_a_kind_of(ProgramPoint)
481
+ end
482
+
483
+ it "should return the right ProgramPoint" do
484
+ caught = NudgeProgram.new(@bigger_tree)[3]
485
+ caught.should be_a_kind_of(ValuePoint)
486
+ caught.value.should == 2
487
+ NudgeProgram.new(@bigger_tree)[2].blueprint_parts[1].should == "«code» value «int»\n«int» 1"
488
+ end
489
+ end
490
+
491
+
492
+ describe "deep_copy" do
493
+ it "should return a copy of the NudgeProgram that contains NONE of the same object_ids" do
494
+ tree = "block { value «code» value «int»}\n«int»1\n«code» value «int»\n«int» 2"
495
+ start = NudgeProgram.new(tree)
496
+ cloned = start.clone
497
+
498
+ # expected behavior from #clone
499
+ cloned.linked_code.collect{|node| node.object_id}.should ==
500
+ start.linked_code.collect{|node| node.object_id}
501
+
502
+ deeply = start.deep_copy
503
+ 0.upto(2) {|i| deeply.linked_code.collect{|node| node.object_id}[i].should_not ==
504
+ start.linked_code.collect{|node| node.object_id}[i] }
505
+
506
+
507
+ end
508
+ end
509
+
510
+
511
+ describe "#cleanup_strings_from_linked_code!" do
512
+ it "should [re-]derive the NudgeProgram's #raw_code, #code_section and #footnote_section" do
513
+ mess_with_me = NudgeProgram.new("value «foo»\n«foo» bar\n«baz» qux")
514
+ mess_with_me.raw_code = "oh, that's really funny"
515
+ mess_with_me.code_section = "totally: ha"
516
+ mess_with_me.footnote_section = "no, really, I am laughing"
517
+
518
+ mess_with_me.cleanup_strings_from_linked_code!
519
+ mess_with_me.raw_code.should_not == "oh, that's really funny"
520
+ mess_with_me.footnote_section.should == "«foo» bar\n«baz» qux"
521
+
522
+ end
523
+ end
524
+
525
+
526
+ describe "#replace_point method" do
527
+ before(:each) do
528
+ @bigger_tree = "block { value «code» value «int»}\n«int»1\n«code» value «int»\n«int» 2"
529
+ @deeper_tree = "block { block {ref a block {ref b}} ref c}"
530
+ @starter = NudgeProgram.new(@bigger_tree)
531
+ @new_chunk = ReferencePoint.new("HI")
532
+ end
533
+
534
+ it "should raise an ArgumentError if the index is 0 or less" do
535
+ lambda{@starter.replace_point(-8,@new_chunk)}.should raise_error(ArgumentError)
536
+ lambda{@starter.replace_point(0,@new_chunk)}.should raise_error(ArgumentError)
537
+ end
538
+
539
+ it "should raise an ArgumentError if the index is more than self.points" do
540
+ lambda{@starter.replace_point(9919,@new_chunk)}.should raise_error(ArgumentError)
541
+ end
542
+
543
+ it "should raise an ArgumentError if the second argument isn't a ProgramPoint" do
544
+ lambda{@starter.replace_point(1,"hello")}.should raise_error(ArgumentError)
545
+ end
546
+
547
+ it "should return a new NudgeProgram based on the new code if which=1" do
548
+ result = @starter.replace_point(1,@new_chunk)
549
+ result.should be_a_kind_of(NudgeProgram)
550
+ result.blueprint.should == "ref HI"
551
+ end
552
+
553
+ it "should not damage the invoking NudgeProgram" do
554
+ result = @starter.replace_point(1,@new_chunk)
555
+ @starter.raw_code.should == @bigger_tree
556
+ end
557
+
558
+ it "should return a new NudgeProgram" do
559
+ result = @starter.replace_point(2,@new_chunk)
560
+ result.should be_a_kind_of(NudgeProgram)
561
+ end
562
+
563
+ it "should return a new NudgeProgram with the right ProgramPoint replaced in its linked_code" do
564
+ # untouched = "block {\n block {\n ref a\n block {\n ref b}}\n ref c}"
565
+ reffy = NudgeProgram.new(@deeper_tree)
566
+
567
+ result = reffy.replace_point(2,@new_chunk)
568
+ result.blueprint.should == "block {\n ref HI\n ref c}"
569
+
570
+ result = reffy.replace_point(3,@new_chunk)
571
+ result.blueprint.should == "block {\n block {\n ref HI\n block {\n ref b}}\n ref c}"
572
+
573
+ result = reffy.replace_point(4,@new_chunk)
574
+ result.blueprint.should == "block {\n block {\n ref a\n ref HI}\n ref c}"
575
+
576
+ result = reffy.replace_point(5,@new_chunk)
577
+ result.blueprint.should == "block {\n block {\n ref a\n block {\n ref HI}}\n ref c}"
578
+
579
+ result = reffy.replace_point(6,@new_chunk)
580
+ result.blueprint.should == "block {\n block {\n ref a\n block {\n ref b}}\n ref HI}"
581
+ end
582
+
583
+ it "should produce the expected footnotes in the resulting program" do
584
+ valueful = NudgeProgram.new(
585
+ "block {value «code» value «code»}\n«code»block {value «int»}\n«int» 7\n«code» value «bool»")
586
+ addedvalue = ValuePoint.new("foo","•••")
587
+
588
+ valueful.replace_point(1,addedvalue).blueprint.should ==
589
+ "value «foo» \n«foo» •••"
590
+
591
+ valueful.replace_point(2,addedvalue).blueprint.should ==
592
+ "block {\n value «foo»\n value «code»} \n«foo» •••\n«code» value «bool»"
593
+
594
+ valueful.replace_point(3,addedvalue).blueprint.should ==
595
+ "block {\n value «code»\n value «foo»} \n«code» block {value «int»}\n«int» 7\n«foo» •••"
596
+ end
597
+
598
+ it "should synchronize the #raw_code, #footnote_section #code_section strings" do
599
+ starting_from = NudgeProgram.new("value «foo»\n«foo» bar\n«baz» qux")
600
+ starting_raw = starting_from.raw_code
601
+ starting_code = starting_from.code_section
602
+ starting_fn = starting_from.footnote_section
603
+
604
+ revised = starting_from.replace_point(1,CodeblockPoint.new)
605
+
606
+ revised.blueprint.should == "block {} \n«baz» qux"
607
+ revised.raw_code.should == "block {} \n«baz» qux"
608
+ revised.footnote_section.should == "«baz» qux"
609
+ revised.code_section.should == "block {}"
610
+ end
611
+
612
+ it "should not affect unused footnotes" do
613
+ unclear_on_concept = NudgeProgram.new("value «int»\n«bool» false")
614
+ unclear_on_concept.replace_point(1,ReferencePoint.new("x")).footnote_section.should == "«bool» false"
615
+ end
616
+ end
617
+
618
+
619
+ describe "#delete_point method" do
620
+ before(:each) do
621
+ @tree_with_values = NudgeProgram.new(
622
+ "block { value «code» value «int»}\n«int»1\n«code» value «int»\n«int» 2")
623
+ @lodgepole_tree = NudgeProgram.new(
624
+ "block{block{block{block{block{block {ref a}}}}}}")
625
+ end
626
+
627
+ it "should raise an ArgumentError if the index is 0 or less" do
628
+ lambda{@tree_with_values.delete_point(-8)}.should raise_error(ArgumentError)
629
+ lambda{@tree_with_values.delete_point(0)}.should raise_error(ArgumentError)
630
+ end
631
+
632
+ it "should raise an ArgumentError if the index is more than self.points" do
633
+ lambda{@tree_with_values.delete_point(10000)}.should raise_error(ArgumentError)
634
+ end
635
+
636
+ it "should return a NudgeProgram with code 'block {}' if which=1" do
637
+ result = @tree_with_values.delete_point(1)
638
+ result.should be_a_kind_of(NudgeProgram)
639
+ result.blueprint.should == "block {}"
640
+ result.linked_code.should_not == nil
641
+ end
642
+
643
+ it "should not damage the invoking NudgeProgram" do
644
+ starting = @tree_with_values.blueprint
645
+ result = @tree_with_values.delete_point(1)
646
+ @tree_with_values.blueprint.should == starting
647
+ end
648
+
649
+ it "should return a new NudgeProgram" do
650
+ result = @tree_with_values.delete_point(2)
651
+ result.should be_a_kind_of(NudgeProgram)
652
+ end
653
+
654
+ it "should return a new NudgeProgram with the right ProgramPoint deleted" do
655
+ # "block {\n block {\n block {\n block {\n block {\n block {\n ref a}}}}}}"
656
+ result = @lodgepole_tree.delete_point(1)
657
+ result.blueprint.should == "block {}"
658
+
659
+ result = @lodgepole_tree.delete_point(2)
660
+ result.blueprint.should == "block {}"
661
+
662
+ result = @lodgepole_tree.delete_point(4)
663
+ result.blueprint.should == "block {\n block {\n block {}}}"
664
+
665
+ result = @lodgepole_tree.delete_point(7)
666
+ result.blueprint.should == "block {\n block {\n block {\n block {\n block {\n block {}}}}}}"
667
+ end
668
+
669
+ it "should leave the expected footnotes in the resulting program" do
670
+ valueful = NudgeProgram.new(
671
+ "block {value «code» value «code»}\n«code»block {value «int»}\n«int» 7\n«code» value «bool»")
672
+
673
+ valueful.delete_point(1).blueprint.should ==
674
+ "block {}"
675
+
676
+ valueful.delete_point(2).blueprint.should ==
677
+ "block {\n value «code»} \n«code» value «bool»"
678
+
679
+ valueful.delete_point(3).blueprint.should ==
680
+ "block {\n value «code»} \n«code» block {value «int»}\n«int» 7"
681
+ end
682
+
683
+ it "should not delete unused footnotes" do
684
+ unclear_on_concept = NudgeProgram.new("value «int»\n«bool» false")
685
+ unclear_on_concept.delete_point(1).blueprint.should == "block {} \n«bool» false"
686
+ end
687
+ end
688
+
689
+
690
+ describe "#insert_point_before method" do
691
+ before(:each) do
692
+ @bigger_tree = "block { value «code» value «int»}\n«int»1\n«code» value «int»\n«int» 2"
693
+ @deeper_tree = "block { block {ref a block {ref b}} ref c}"
694
+ @starter = NudgeProgram.new(@bigger_tree)
695
+ @new_chunk = ReferencePoint.new("HI")
696
+ end
697
+
698
+ it "should raise an ArgumentError if the index is 0 or less" do
699
+ lambda{@starter.insert_point_before(0,@new_chunk)}.should raise_error(ArgumentError)
700
+ lambda{@starter.insert_point_before(1,@new_chunk)}.should_not raise_error(ArgumentError)
701
+ end
702
+
703
+ it "should raise an ArgumentError if the index is bigger than old_code.points" do
704
+ lambda{@starter.insert_point_before(4,@new_chunk)}.should_not raise_error(ArgumentError)
705
+ lambda{@starter.insert_point_before(5,@new_chunk)}.should raise_error(ArgumentError)
706
+ end
707
+
708
+ it "should raise an ArgumentError if the second argument isn't a ProgramPoint" do
709
+ lambda{@starter.insert_point_before(3,"not valid")}.should raise_error(ArgumentError)
710
+ end
711
+
712
+ it "should create a block around the new code and the old code if pos = 1" do
713
+ in_the_front = @starter.insert_point_before(1,@new_chunk)
714
+ in_the_front.linked_code.should be_a_kind_of(CodeblockPoint)
715
+ in_the_front[2].should be_a_kind_of(ReferencePoint)
716
+ in_the_front[3].should be_a_kind_of(CodeblockPoint)
717
+ in_the_front.points.should == 1 + @starter.points + 1 # from the insertion
718
+ end
719
+
720
+ it "should create a block around the old code and the new code if pos = old.pts+1" do
721
+ in_the_back = @starter.insert_point_before(4,@new_chunk)
722
+ in_the_back.linked_code.should be_a_kind_of(CodeblockPoint)
723
+ in_the_back[2].should be_a_kind_of(CodeblockPoint)
724
+ in_the_back[5].should be_a_kind_of(ReferencePoint)
725
+ in_the_back.points.should == 1 + @starter.points + 1 # from the insertion
726
+ end
727
+
728
+ it "should return a new NudgeProgram with the right ProgramPoint inserted in its linked_code" do
729
+ in_the_midst = @starter.insert_point_before(2,@new_chunk)
730
+ # "block { ref HI value «code» value «int»}\n«int»1\n«code» value «int»\n«int» 2"
731
+
732
+ in_the_midst.linked_code.should be_a_kind_of(CodeblockPoint)
733
+ in_the_midst[2].should be_a_kind_of(ReferencePoint)
734
+ in_the_midst[3].should be_a_kind_of(ValuePoint)
735
+ in_the_midst.points.should == @starter.points + 1 # from the insertion
736
+ end
737
+
738
+
739
+ it "should not change the invoking NudgeProgram" do
740
+ old_code = @starter.blueprint
741
+ in_the_midst = @starter.insert_point_before(2,@new_chunk)
742
+ @starter.blueprint.should == old_code
743
+ in_the_midst.blueprint.should_not == old_code
744
+ end
745
+
746
+ it "should return a new NudgeProgram" do
747
+ old_id = @starter.object_id
748
+ in_the_midst = @starter.insert_point_before(2,@new_chunk)
749
+ in_the_midst.object_id.should_not == old_id
750
+ end
751
+
752
+ it "should produce the expected footnotes in the resulting program" do
753
+ complicated = @starter.insert_point_before(3,@starter.linked_code.clone)
754
+ complicated.blueprint.should == "block {\n value «code»\n block {\n value «code»\n value «int»}\n value «int»} \n«code» value «int»\n«int» 1\n«code» value «int»\n«int» 1\n«int» 2\n«int» 2"
755
+ end
756
+
757
+ it "should synchronize the #raw_code, #footnote_section #code_section strings" do
758
+ complicated = @starter.insert_point_before(3,@starter.linked_code.clone)
759
+ complicated.raw_code.should_not == @starter.raw_code
760
+ complicated.raw_code.should == complicated.blueprint
761
+ complicated.footnote_section.should_not == @starter.footnote_section
762
+ complicated.footnote_section.should ==
763
+ "«code» value «int»\n«int» 1\n«code» value «int»\n«int» 1\n«int» 2\n«int» 2"
764
+ complicated.code_section.should_not == @starter.code_section
765
+ end
766
+
767
+ it "should work correctly with unused footnotes" do
768
+ wordy = NudgeProgram.new("block {}\n«foo» bar")
769
+ interrupted = wordy.insert_point_before(1,@starter.linked_code)
770
+ interrupted.footnote_section.should include("foo")
771
+ end
772
+ end
773
+
774
+ end