haml-more 0.4.0.a

Sign up to get free protection for your applications and to get access to all the features.
Files changed (225) hide show
  1. data/README.md +79 -0
  2. data/lib/haml/more/coffee_script.rb +137 -0
  3. data/lib/haml/more/content_for.rb +25 -0
  4. data/lib/haml/more.rb +45 -0
  5. data/lib/haml-more.rb +1 -0
  6. data/lib/sass/more.rb +16 -0
  7. data/lib/sass-more.rb +1 -0
  8. data/spec/sass/more_spec.rb +21 -0
  9. data/vendor/coffee-script/Cakefile +57 -0
  10. data/vendor/coffee-script/LICENSE +22 -0
  11. data/vendor/coffee-script/README +41 -0
  12. data/vendor/coffee-script/Rakefile +20 -0
  13. data/vendor/coffee-script/bin/cake +7 -0
  14. data/vendor/coffee-script/bin/coffee +7 -0
  15. data/vendor/coffee-script/documentation/coffee/aliases.coffee +9 -0
  16. data/vendor/coffee-script/documentation/coffee/arguments.coffee +4 -0
  17. data/vendor/coffee-script/documentation/coffee/array_comprehensions.coffee +7 -0
  18. data/vendor/coffee-script/documentation/coffee/assignment.coffee +2 -0
  19. data/vendor/coffee-script/documentation/coffee/cake_tasks.coffee +5 -0
  20. data/vendor/coffee-script/documentation/coffee/comparisons.coffee +5 -0
  21. data/vendor/coffee-script/documentation/coffee/conditionals.coffee +9 -0
  22. data/vendor/coffee-script/documentation/coffee/embedded.coffee +5 -0
  23. data/vendor/coffee-script/documentation/coffee/existence.coffee +8 -0
  24. data/vendor/coffee-script/documentation/coffee/expressions.coffee +9 -0
  25. data/vendor/coffee-script/documentation/coffee/expressions_assignment.coffee +1 -0
  26. data/vendor/coffee-script/documentation/coffee/expressions_comprehension.coffee +3 -0
  27. data/vendor/coffee-script/documentation/coffee/expressions_try.coffee +6 -0
  28. data/vendor/coffee-script/documentation/coffee/fat_arrow.coffee +6 -0
  29. data/vendor/coffee-script/documentation/coffee/functions.coffee +2 -0
  30. data/vendor/coffee-script/documentation/coffee/heredocs.coffee +5 -0
  31. data/vendor/coffee-script/documentation/coffee/multiple_return_values.coffee +5 -0
  32. data/vendor/coffee-script/documentation/coffee/object_comprehensions.coffee +4 -0
  33. data/vendor/coffee-script/documentation/coffee/object_extraction.coffee +13 -0
  34. data/vendor/coffee-script/documentation/coffee/objects_and_arrays.coffee +13 -0
  35. data/vendor/coffee-script/documentation/coffee/overview.coffee +29 -0
  36. data/vendor/coffee-script/documentation/coffee/parallel_assignment.coffee +4 -0
  37. data/vendor/coffee-script/documentation/coffee/range_comprehensions.coffee +6 -0
  38. data/vendor/coffee-script/documentation/coffee/scope.coffee +5 -0
  39. data/vendor/coffee-script/documentation/coffee/slices.coffee +6 -0
  40. data/vendor/coffee-script/documentation/coffee/soaks.coffee +1 -0
  41. data/vendor/coffee-script/documentation/coffee/splats.coffee +25 -0
  42. data/vendor/coffee-script/documentation/coffee/splices.coffee +5 -0
  43. data/vendor/coffee-script/documentation/coffee/strings.coffee +8 -0
  44. data/vendor/coffee-script/documentation/coffee/super.coffee +34 -0
  45. data/vendor/coffee-script/documentation/coffee/switch.coffee +10 -0
  46. data/vendor/coffee-script/documentation/coffee/try.coffee +7 -0
  47. data/vendor/coffee-script/documentation/coffee/while.coffee +10 -0
  48. data/vendor/coffee-script/documentation/css/docs.css +213 -0
  49. data/vendor/coffee-script/documentation/css/idle.css +63 -0
  50. data/vendor/coffee-script/documentation/css/logo.png +0 -0
  51. data/vendor/coffee-script/documentation/index.html.erb +967 -0
  52. data/vendor/coffee-script/documentation/js/aliases.js +14 -0
  53. data/vendor/coffee-script/documentation/js/arguments.js +8 -0
  54. data/vendor/coffee-script/documentation/js/array_comprehensions.js +26 -0
  55. data/vendor/coffee-script/documentation/js/assignment.js +5 -0
  56. data/vendor/coffee-script/documentation/js/cake_tasks.js +14 -0
  57. data/vendor/coffee-script/documentation/js/comparisons.js +5 -0
  58. data/vendor/coffee-script/documentation/js/conditionals.js +12 -0
  59. data/vendor/coffee-script/documentation/js/embedded.js +6 -0
  60. data/vendor/coffee-script/documentation/js/existence.js +7 -0
  61. data/vendor/coffee-script/documentation/js/expressions.js +13 -0
  62. data/vendor/coffee-script/documentation/js/expressions_assignment.js +4 -0
  63. data/vendor/coffee-script/documentation/js/expressions_comprehension.js +12 -0
  64. data/vendor/coffee-script/documentation/js/expressions_try.js +9 -0
  65. data/vendor/coffee-script/documentation/js/fat_arrow.js +15 -0
  66. data/vendor/coffee-script/documentation/js/functions.js +9 -0
  67. data/vendor/coffee-script/documentation/js/heredocs.js +4 -0
  68. data/vendor/coffee-script/documentation/js/intro.js +7 -0
  69. data/vendor/coffee-script/documentation/js/multiple_return_values.js +11 -0
  70. data/vendor/coffee-script/documentation/js/object_comprehensions.js +17 -0
  71. data/vendor/coffee-script/documentation/js/object_extraction.js +17 -0
  72. data/vendor/coffee-script/documentation/js/objects_and_arrays.js +10 -0
  73. data/vendor/coffee-script/documentation/js/overview.js +43 -0
  74. data/vendor/coffee-script/documentation/js/parallel_assignment.js +8 -0
  75. data/vendor/coffee-script/documentation/js/punctuation.js +8 -0
  76. data/vendor/coffee-script/documentation/js/range_comprehensions.js +21 -0
  77. data/vendor/coffee-script/documentation/js/scope.js +10 -0
  78. data/vendor/coffee-script/documentation/js/slices.js +6 -0
  79. data/vendor/coffee-script/documentation/js/soaks.js +4 -0
  80. data/vendor/coffee-script/documentation/js/splats.js +16 -0
  81. data/vendor/coffee-script/documentation/js/splices.js +5 -0
  82. data/vendor/coffee-script/documentation/js/strings.js +9 -0
  83. data/vendor/coffee-script/documentation/js/super.js +37 -0
  84. data/vendor/coffee-script/documentation/js/switch.js +18 -0
  85. data/vendor/coffee-script/documentation/js/try.js +10 -0
  86. data/vendor/coffee-script/documentation/js/while.js +22 -0
  87. data/vendor/coffee-script/documentation/underscore.html +627 -0
  88. data/vendor/coffee-script/examples/beautiful_code/binary_search.coffee +16 -0
  89. data/vendor/coffee-script/examples/beautiful_code/quicksort_runtime.coffee +13 -0
  90. data/vendor/coffee-script/examples/beautiful_code/regular_expression_matcher.coffee +34 -0
  91. data/vendor/coffee-script/examples/blocks.coffee +57 -0
  92. data/vendor/coffee-script/examples/code.coffee +173 -0
  93. data/vendor/coffee-script/examples/computer_science/README +4 -0
  94. data/vendor/coffee-script/examples/computer_science/binary_search.coffee +25 -0
  95. data/vendor/coffee-script/examples/computer_science/bubble_sort.coffee +11 -0
  96. data/vendor/coffee-script/examples/computer_science/linked_list.coffee +106 -0
  97. data/vendor/coffee-script/examples/computer_science/luhn_algorithm.coffee +36 -0
  98. data/vendor/coffee-script/examples/computer_science/merge_sort.coffee +19 -0
  99. data/vendor/coffee-script/examples/computer_science/selection_sort.coffee +23 -0
  100. data/vendor/coffee-script/examples/poignant.coffee +186 -0
  101. data/vendor/coffee-script/examples/potion.coffee +205 -0
  102. data/vendor/coffee-script/examples/underscore.coffee +603 -0
  103. data/vendor/coffee-script/examples/web_server.coffee +12 -0
  104. data/vendor/coffee-script/extras/CoffeeScript.tmbundle/Preferences/CoffeeScript.tmPreferences +24 -0
  105. data/vendor/coffee-script/extras/CoffeeScript.tmbundle/Syntaxes/CoffeeScript.tmLanguage +361 -0
  106. data/vendor/coffee-script/extras/CoffeeScript.tmbundle/info.plist +10 -0
  107. data/vendor/coffee-script/extras/EXTRAS +20 -0
  108. data/vendor/coffee-script/extras/coffee.vim +117 -0
  109. data/vendor/coffee-script/index.html +1847 -0
  110. data/vendor/coffee-script/lib/bin/cake +7 -0
  111. data/vendor/coffee-script/lib/bin/coffee +7 -0
  112. data/vendor/coffee-script/lib/cake.js +80 -0
  113. data/vendor/coffee-script/lib/coffee-script.js +61 -0
  114. data/vendor/coffee-script/lib/command_line.js +201 -0
  115. data/vendor/coffee-script/lib/grammar.js +564 -0
  116. data/vendor/coffee-script/lib/lexer.js +405 -0
  117. data/vendor/coffee-script/lib/narwhal.js +44 -0
  118. data/vendor/coffee-script/lib/nodes.js +1328 -0
  119. data/vendor/coffee-script/lib/optparse.js +117 -0
  120. data/vendor/coffee-script/lib/parser.js +536 -0
  121. data/vendor/coffee-script/lib/repl.js +32 -0
  122. data/vendor/coffee-script/lib/rewriter.js +383 -0
  123. data/vendor/coffee-script/lib/scope.js +114 -0
  124. data/vendor/coffee-script/package.json +7 -0
  125. data/vendor/coffee-script/src/cake.coffee +45 -0
  126. data/vendor/coffee-script/src/coffee-script.coffee +45 -0
  127. data/vendor/coffee-script/src/command_line.coffee +130 -0
  128. data/vendor/coffee-script/src/grammar.coffee +456 -0
  129. data/vendor/coffee-script/src/lexer.coffee +327 -0
  130. data/vendor/coffee-script/src/narwhal.coffee +42 -0
  131. data/vendor/coffee-script/src/nodes.coffee +1045 -0
  132. data/vendor/coffee-script/src/optparse.coffee +79 -0
  133. data/vendor/coffee-script/src/repl.coffee +23 -0
  134. data/vendor/coffee-script/src/rewriter.coffee +253 -0
  135. data/vendor/coffee-script/src/scope.coffee +75 -0
  136. data/vendor/coffee-script/test/test_arguments.coffee +34 -0
  137. data/vendor/coffee-script/test/test_array_comprehension.coffee +42 -0
  138. data/vendor/coffee-script/test/test_assignment.coffee +26 -0
  139. data/vendor/coffee-script/test/test_blocks.coffee +4 -0
  140. data/vendor/coffee-script/test/test_calling_super.coffee +42 -0
  141. data/vendor/coffee-script/test/test_chained_calls.coffee +25 -0
  142. data/vendor/coffee-script/test/test_destructuring_assignment.coffee +62 -0
  143. data/vendor/coffee-script/test/test_everything.coffee +29 -0
  144. data/vendor/coffee-script/test/test_exceptions.coffee +2 -0
  145. data/vendor/coffee-script/test/test_existence.coffee +81 -0
  146. data/vendor/coffee-script/test/test_expressions.coffee +30 -0
  147. data/vendor/coffee-script/test/test_fancy_if_statement.coffee +26 -0
  148. data/vendor/coffee-script/test/test_functions.coffee +80 -0
  149. data/vendor/coffee-script/test/test_funky_comments.coffee +25 -0
  150. data/vendor/coffee-script/test/test_heredocs.coffee +46 -0
  151. data/vendor/coffee-script/test/test_lexical_scope.coffee +10 -0
  152. data/vendor/coffee-script/test/test_literals.coffee +56 -0
  153. data/vendor/coffee-script/test/test_nested_comprehensions.coffee +11 -0
  154. data/vendor/coffee-script/test/test_newline_escaping.coffee +6 -0
  155. data/vendor/coffee-script/test/test_operations.coffee +18 -0
  156. data/vendor/coffee-script/test/test_range_comprehension.coffee +20 -0
  157. data/vendor/coffee-script/test/test_ranges_and_slices.coffee +16 -0
  158. data/vendor/coffee-script/test/test_splats.coffee +47 -0
  159. data/vendor/coffee-script/test/test_splices.coffee +5 -0
  160. data/vendor/coffee-script/test/test_switch.coffee +64 -0
  161. data/vendor/coffee-script/test/test_while.coffee +30 -0
  162. data/vendor/coffee-script/vendor/jison/Jakefile +31 -0
  163. data/vendor/coffee-script/vendor/jison/README.md +347 -0
  164. data/vendor/coffee-script/vendor/jison/bin/jison +3 -0
  165. data/vendor/coffee-script/vendor/jison/bin/json2jison +3 -0
  166. data/vendor/coffee-script/vendor/jison/examples/ansic.jison +415 -0
  167. data/vendor/coffee-script/vendor/jison/examples/basic.json +8 -0
  168. data/vendor/coffee-script/vendor/jison/examples/basic2.json +9 -0
  169. data/vendor/coffee-script/vendor/jison/examples/basic2_lex.json +16 -0
  170. data/vendor/coffee-script/vendor/jison/examples/basic_lex.json +15 -0
  171. data/vendor/coffee-script/vendor/jison/examples/calculator.jison +38 -0
  172. data/vendor/coffee-script/vendor/jison/examples/calculator.jisonlex +14 -0
  173. data/vendor/coffee-script/vendor/jison/examples/calculator.json +42 -0
  174. data/vendor/coffee-script/vendor/jison/examples/classy.json +105 -0
  175. data/vendor/coffee-script/vendor/jison/examples/classy_ast.json +126 -0
  176. data/vendor/coffee-script/vendor/jison/examples/dism.json +25 -0
  177. data/vendor/coffee-script/vendor/jison/examples/dism_lr0.json +26 -0
  178. data/vendor/coffee-script/vendor/jison/examples/json.js +80 -0
  179. data/vendor/coffee-script/vendor/jison/examples/json_ast.js +83 -0
  180. data/vendor/coffee-script/vendor/jison/examples/precedence.json +26 -0
  181. data/vendor/coffee-script/vendor/jison/examples/reduce_conflict.json +13 -0
  182. data/vendor/coffee-script/vendor/jison/lib/jison/bnf.js +43 -0
  183. data/vendor/coffee-script/vendor/jison/lib/jison/jisonlex.js +18 -0
  184. data/vendor/coffee-script/vendor/jison/lib/jison/json2jison.js +146 -0
  185. data/vendor/coffee-script/vendor/jison/lib/jison/lexer.js +224 -0
  186. data/vendor/coffee-script/vendor/jison/lib/jison/util/bnf-parser.js +383 -0
  187. data/vendor/coffee-script/vendor/jison/lib/jison/util/lex-parser.js +407 -0
  188. data/vendor/coffee-script/vendor/jison/lib/jison/util/set.js +94 -0
  189. data/vendor/coffee-script/vendor/jison/lib/jison/util/typal.js +90 -0
  190. data/vendor/coffee-script/vendor/jison/lib/jison.js +1414 -0
  191. data/vendor/coffee-script/vendor/jison/package.json +14 -0
  192. data/vendor/coffee-script/vendor/jison/src/bnf.jison +110 -0
  193. data/vendor/coffee-script/vendor/jison/src/bnf.jisonlex +25 -0
  194. data/vendor/coffee-script/vendor/jison/src/bnf.lex.json +24 -0
  195. data/vendor/coffee-script/vendor/jison/src/jisonlex.jison +129 -0
  196. data/vendor/coffee-script/vendor/jison/src/jisonlex.jisonlex +31 -0
  197. data/vendor/coffee-script/vendor/jison/src/jisonlex.lex.json +30 -0
  198. data/vendor/coffee-script/vendor/jison/tests/all-tests.js +8 -0
  199. data/vendor/coffee-script/vendor/jison/tests/grammar/bnf.js +91 -0
  200. data/vendor/coffee-script/vendor/jison/tests/grammar/bnf_parse.js +65 -0
  201. data/vendor/coffee-script/vendor/jison/tests/grammar/grammar-tests.js +10 -0
  202. data/vendor/coffee-script/vendor/jison/tests/grammar/json2jison.js +24 -0
  203. data/vendor/coffee-script/vendor/jison/tests/grammar/lex/ansic.jisonlex +115 -0
  204. data/vendor/coffee-script/vendor/jison/tests/grammar/lex/bnf.jisonlex +25 -0
  205. data/vendor/coffee-script/vendor/jison/tests/grammar/lex/bnf.lex.json +24 -0
  206. data/vendor/coffee-script/vendor/jison/tests/grammar/lex/lex_grammar.jisonlex +31 -0
  207. data/vendor/coffee-script/vendor/jison/tests/grammar/lex/lex_grammar.lex.json +30 -0
  208. data/vendor/coffee-script/vendor/jison/tests/grammar/lex.jison +119 -0
  209. data/vendor/coffee-script/vendor/jison/tests/grammar/lex.js +58 -0
  210. data/vendor/coffee-script/vendor/jison/tests/grammar/lex_parse.js +117 -0
  211. data/vendor/coffee-script/vendor/jison/tests/lexer/lexer-tests.js +6 -0
  212. data/vendor/coffee-script/vendor/jison/tests/lexer/regexplexer.js +417 -0
  213. data/vendor/coffee-script/vendor/jison/tests/parser/actions.js +311 -0
  214. data/vendor/coffee-script/vendor/jison/tests/parser/api.js +236 -0
  215. data/vendor/coffee-script/vendor/jison/tests/parser/generator.js +196 -0
  216. data/vendor/coffee-script/vendor/jison/tests/parser/lalr.js +183 -0
  217. data/vendor/coffee-script/vendor/jison/tests/parser/lr0.js +72 -0
  218. data/vendor/coffee-script/vendor/jison/tests/parser/lr1.js +119 -0
  219. data/vendor/coffee-script/vendor/jison/tests/parser/parser-tests.js +14 -0
  220. data/vendor/coffee-script/vendor/jison/tests/parser/precedence.js +237 -0
  221. data/vendor/coffee-script/vendor/jison/tests/parser/slr.js +52 -0
  222. data/vendor/coffee-script/vendor/jison/tests/parser/tables.js +126 -0
  223. data/vendor/coffee-script/vendor/jison/tests/performance.js +110 -0
  224. data/vendor/coffee-script/vendor/jison/tests/setup.js +3 -0
  225. metadata +324 -0
@@ -0,0 +1,407 @@
1
+ /* Jison generated parser */
2
+ var jisonlex = (function(){
3
+ var parser = {trace: function trace() {
4
+ },
5
+ yy: {},
6
+ symbols_: {"lex":2,"definitions":3,"include":4,"%%":5,"rules":6,"EOF":7,"action":8,"definition":9,"name":10,"regex":11,"NAME":12,"rule":13,"ACTION":14,"regex_list":15,"|":16,"regex_concat":17,"regex_base":18,"(":19,")":20,"+":21,"*":22,"?":23,"/":24,"name_expansion":25,"range_regex":26,"any_group_regex":27,".":28,"^":29,"$":30,"string":31,"escape_char":32,"{":33,"}":34,"ANY_GROUP_REGEX":35,"ESCAPE_CHAR":36,"RANGE_REGEX":37,"STRING_LIT":38,"$accept":0,"$end":1},
7
+ terminals_: {"5":"%%","7":"EOF","12":"NAME","14":"ACTION","16":"|","19":"(","20":")","21":"+","22":"*","23":"?","24":"/","28":".","29":"^","30":"$","33":"{","34":"}","35":"ANY_GROUP_REGEX","36":"ESCAPE_CHAR","37":"RANGE_REGEX","38":"STRING_LIT"},
8
+ productions_: [0,[2,6],[2,5],[4,1],[4,0],[3,2],[3,0],[9,2],[10,1],[6,2],[6,1],[13,2],[8,1],[11,1],[15,3],[15,1],[17,2],[17,1],[18,3],[18,2],[18,2],[18,2],[18,2],[18,1],[18,2],[18,1],[18,1],[18,1],[18,1],[18,1],[18,1],[25,3],[27,1],[32,1],[26,1],[31,1]],
9
+ performAction: function anonymous(yytext, yyleng, yylineno, yy) {
10
+ var $$ = arguments[5], $0 = arguments[5].length;
11
+ switch (arguments[4]) {
12
+ case 1:
13
+ this.$ = {rules: $$[$0 - 6 + 4 - 1]};
14
+ if ($$[$0 - 6 + 1 - 1].length) {
15
+ this.$.macros = $$[$0 - 6 + 1 - 1];
16
+ }
17
+ if ($$[$0 - 6 + 2 - 1]) {
18
+ this.$.actionInclude = $$[$0 - 6 + 2 - 1];
19
+ }
20
+ return this.$;
21
+ break;
22
+ case 2:
23
+ this.$ = {rules: $$[$0 - 5 + 4 - 1]};
24
+ if ($$[$0 - 5 + 1 - 1].length) {
25
+ this.$.macros = $$[$0 - 5 + 1 - 1];
26
+ }
27
+ if ($$[$0 - 5 + 2 - 1]) {
28
+ this.$.actionInclude = $$[$0 - 5 + 2 - 1];
29
+ }
30
+ return this.$;
31
+ break;
32
+ case 5:
33
+ this.$ = $$[$0 - 2 + 1 - 1];
34
+ this.$.push($$[$0 - 2 + 2 - 1]);
35
+ break;
36
+ case 6:
37
+ this.$ = [];
38
+ break;
39
+ case 7:
40
+ this.$ = [$$[$0 - 2 + 1 - 1], $$[$0 - 2 + 2 - 1]];
41
+ break;
42
+ case 8:
43
+ this.$ = yytext;
44
+ break;
45
+ case 9:
46
+ this.$ = $$[$0 - 2 + 1 - 1];
47
+ this.$.push($$[$0 - 2 + 2 - 1]);
48
+ break;
49
+ case 10:
50
+ this.$ = [$$[$0 - 1 + 1 - 1]];
51
+ break;
52
+ case 11:
53
+ this.$ = [$$[$0 - 2 + 1 - 1], $$[$0 - 2 + 2 - 1]];
54
+ break;
55
+ case 12:
56
+ this.$ = yytext;
57
+ break;
58
+ case 13:
59
+ this.$ = $$[$0 - 1 + 1 - 1];
60
+ if (this.$.match(/[\w\d]$/)) {
61
+ this.$ += "\\b";
62
+ }
63
+ break;
64
+ case 14:
65
+ this.$ = $$[$0 - 3 + 1 - 1] + "|" + $$[$0 - 3 + 3 - 1];
66
+ break;
67
+ case 16:
68
+ this.$ = $$[$0 - 2 + 1 - 1] + $$[$0 - 2 + 2 - 1];
69
+ break;
70
+ case 18:
71
+ this.$ = "(" + $$[$0 - 3 + 2 - 1] + ")";
72
+ break;
73
+ case 19:
74
+ this.$ = $$[$0 - 2 + 1 - 1] + "+";
75
+ break;
76
+ case 20:
77
+ this.$ = $$[$0 - 2 + 1 - 1] + "*";
78
+ break;
79
+ case 21:
80
+ this.$ = $$[$0 - 2 + 1 - 1] + "?";
81
+ break;
82
+ case 22:
83
+ this.$ = "(?=" + $$[$0 - 2 + 2 - 1] + ")";
84
+ break;
85
+ case 24:
86
+ this.$ = $$[$0 - 2 + 1 - 1] + $$[$0 - 2 + 2 - 1];
87
+ break;
88
+ case 26:
89
+ this.$ = ".";
90
+ break;
91
+ case 27:
92
+ this.$ = "^";
93
+ break;
94
+ case 28:
95
+ this.$ = "$";
96
+ break;
97
+ case 31:
98
+ this.$ = "{" + $$[$0 - 3 + 2 - 1] + "}";
99
+ break;
100
+ case 32:
101
+ this.$ = yytext;
102
+ break;
103
+ case 33:
104
+ this.$ = yytext;
105
+ break;
106
+ case 34:
107
+ this.$ = yytext;
108
+ break;
109
+ case 35:
110
+ this.$ = yy.prepareString(yytext.substr(1, yytext.length - 2));
111
+ break;
112
+ default:;
113
+ }
114
+ },
115
+ table: [{"2":1,"3":2,"5":[[2,6]],"14":[[2,6]],"12":[[2,6]]},{"1":[[3]]},{"4":3,"9":4,"8":5,"10":6,"14":[[1,7]],"12":[[1,8]],"5":[[2,4]]},{"5":[[1,9]]},{"5":[[2,5]],"14":[[2,5]],"12":[[2,5]]},{"5":[[2,3]]},{"11":10,"15":11,"17":12,"18":13,"19":[[1,14]],"24":[[1,15]],"25":16,"27":17,"28":[[1,18]],"29":[[1,19]],"30":[[1,20]],"31":21,"32":22,"33":[[1,23]],"35":[[1,24]],"38":[[1,25]],"36":[[1,26]]},{"5":[[2,12]],"7":[[2,12]],"36":[[2,12]],"38":[[2,12]],"35":[[2,12]],"33":[[2,12]],"19":[[2,12]],"24":[[2,12]],"28":[[2,12]],"29":[[2,12]],"30":[[2,12]]},{"30":[[2,8]],"29":[[2,8]],"28":[[2,8]],"24":[[2,8]],"19":[[2,8]],"33":[[2,8]],"35":[[2,8]],"38":[[2,8]],"36":[[2,8]],"34":[[2,8]]},{"6":27,"13":28,"11":29,"15":11,"17":12,"18":13,"19":[[1,14]],"24":[[1,15]],"25":16,"27":17,"28":[[1,18]],"29":[[1,19]],"30":[[1,20]],"31":21,"32":22,"33":[[1,23]],"35":[[1,24]],"38":[[1,25]],"36":[[1,26]]},{"12":[[2,7]],"14":[[2,7]],"5":[[2,7]]},{"16":[[1,30]],"5":[[2,13]],"14":[[2,13]],"12":[[2,13]]},{"18":31,"19":[[1,14]],"24":[[1,15]],"25":16,"27":17,"28":[[1,18]],"29":[[1,19]],"30":[[1,20]],"31":21,"32":22,"33":[[1,23]],"35":[[1,24]],"38":[[1,25]],"36":[[1,26]],"12":[[2,15]],"14":[[2,15]],"5":[[2,15]],"16":[[2,15]],"20":[[2,15]]},{"21":[[1,32]],"22":[[1,33]],"23":[[1,34]],"26":35,"37":[[1,36]],"16":[[2,17]],"5":[[2,17]],"14":[[2,17]],"12":[[2,17]],"36":[[2,17]],"38":[[2,17]],"35":[[2,17]],"33":[[2,17]],"24":[[2,17]],"28":[[2,17]],"29":[[2,17]],"30":[[2,17]],"19":[[2,17]],"20":[[2,17]]},{"15":37,"17":12,"18":13,"19":[[1,14]],"24":[[1,15]],"25":16,"27":17,"28":[[1,18]],"29":[[1,19]],"30":[[1,20]],"31":21,"32":22,"33":[[1,23]],"35":[[1,24]],"38":[[1,25]],"36":[[1,26]]},{"18":38,"19":[[1,14]],"24":[[1,15]],"25":16,"27":17,"28":[[1,18]],"29":[[1,19]],"30":[[1,20]],"31":21,"32":22,"33":[[1,23]],"35":[[1,24]],"38":[[1,25]],"36":[[1,26]]},{"19":[[2,23]],"30":[[2,23]],"29":[[2,23]],"28":[[2,23]],"24":[[2,23]],"33":[[2,23]],"35":[[2,23]],"38":[[2,23]],"36":[[2,23]],"12":[[2,23]],"14":[[2,23]],"5":[[2,23]],"16":[[2,23]],"21":[[2,23]],"22":[[2,23]],"23":[[2,23]],"37":[[2,23]],"20":[[2,23]]},{"19":[[2,25]],"30":[[2,25]],"29":[[2,25]],"28":[[2,25]],"24":[[2,25]],"33":[[2,25]],"35":[[2,25]],"38":[[2,25]],"36":[[2,25]],"12":[[2,25]],"14":[[2,25]],"5":[[2,25]],"16":[[2,25]],"21":[[2,25]],"22":[[2,25]],"23":[[2,25]],"37":[[2,25]],"20":[[2,25]]},{"19":[[2,26]],"30":[[2,26]],"29":[[2,26]],"28":[[2,26]],"24":[[2,26]],"33":[[2,26]],"35":[[2,26]],"38":[[2,26]],"36":[[2,26]],"12":[[2,26]],"14":[[2,26]],"5":[[2,26]],"16":[[2,26]],"21":[[2,26]],"22":[[2,26]],"23":[[2,26]],"37":[[2,26]],"20":[[2,26]]},{"19":[[2,27]],"30":[[2,27]],"29":[[2,27]],"28":[[2,27]],"24":[[2,27]],"33":[[2,27]],"35":[[2,27]],"38":[[2,27]],"36":[[2,27]],"12":[[2,27]],"14":[[2,27]],"5":[[2,27]],"16":[[2,27]],"21":[[2,27]],"22":[[2,27]],"23":[[2,27]],"37":[[2,27]],"20":[[2,27]]},{"19":[[2,28]],"30":[[2,28]],"29":[[2,28]],"28":[[2,28]],"24":[[2,28]],"33":[[2,28]],"35":[[2,28]],"38":[[2,28]],"36":[[2,28]],"12":[[2,28]],"14":[[2,28]],"5":[[2,28]],"16":[[2,28]],"21":[[2,28]],"22":[[2,28]],"23":[[2,28]],"37":[[2,28]],"20":[[2,28]]},{"19":[[2,29]],"30":[[2,29]],"29":[[2,29]],"28":[[2,29]],"24":[[2,29]],"33":[[2,29]],"35":[[2,29]],"38":[[2,29]],"36":[[2,29]],"12":[[2,29]],"14":[[2,29]],"5":[[2,29]],"16":[[2,29]],"21":[[2,29]],"22":[[2,29]],"23":[[2,29]],"37":[[2,29]],"20":[[2,29]]},{"19":[[2,30]],"30":[[2,30]],"29":[[2,30]],"28":[[2,30]],"24":[[2,30]],"33":[[2,30]],"35":[[2,30]],"38":[[2,30]],"36":[[2,30]],"12":[[2,30]],"14":[[2,30]],"5":[[2,30]],"16":[[2,30]],"21":[[2,30]],"22":[[2,30]],"23":[[2,30]],"37":[[2,30]],"20":[[2,30]]},{"10":39,"12":[[1,8]]},{"37":[[2,32]],"23":[[2,32]],"22":[[2,32]],"21":[[2,32]],"16":[[2,32]],"5":[[2,32]],"14":[[2,32]],"12":[[2,32]],"36":[[2,32]],"38":[[2,32]],"35":[[2,32]],"33":[[2,32]],"24":[[2,32]],"28":[[2,32]],"29":[[2,32]],"30":[[2,32]],"19":[[2,32]],"20":[[2,32]]},{"37":[[2,35]],"23":[[2,35]],"22":[[2,35]],"21":[[2,35]],"16":[[2,35]],"5":[[2,35]],"14":[[2,35]],"12":[[2,35]],"36":[[2,35]],"38":[[2,35]],"35":[[2,35]],"33":[[2,35]],"24":[[2,35]],"28":[[2,35]],"29":[[2,35]],"30":[[2,35]],"19":[[2,35]],"20":[[2,35]]},{"37":[[2,33]],"23":[[2,33]],"22":[[2,33]],"21":[[2,33]],"16":[[2,33]],"5":[[2,33]],"14":[[2,33]],"12":[[2,33]],"36":[[2,33]],"38":[[2,33]],"35":[[2,33]],"33":[[2,33]],"24":[[2,33]],"28":[[2,33]],"29":[[2,33]],"30":[[2,33]],"19":[[2,33]],"20":[[2,33]]},{"5":[[1,40]],"7":[[1,41]],"13":42,"11":29,"15":11,"17":12,"18":13,"19":[[1,14]],"24":[[1,15]],"25":16,"27":17,"28":[[1,18]],"29":[[1,19]],"30":[[1,20]],"31":21,"32":22,"33":[[1,23]],"35":[[1,24]],"38":[[1,25]],"36":[[1,26]]},{"5":[[2,10]],"7":[[2,10]],"36":[[2,10]],"38":[[2,10]],"35":[[2,10]],"33":[[2,10]],"19":[[2,10]],"24":[[2,10]],"28":[[2,10]],"29":[[2,10]],"30":[[2,10]]},{"8":43,"14":[[1,7]]},{"15":44,"17":12,"18":13,"19":[[1,14]],"24":[[1,15]],"25":16,"27":17,"28":[[1,18]],"29":[[1,19]],"30":[[1,20]],"31":21,"32":22,"33":[[1,23]],"35":[[1,24]],"38":[[1,25]],"36":[[1,26]]},{"21":[[1,32]],"22":[[1,33]],"23":[[1,34]],"26":35,"37":[[1,36]],"16":[[2,16]],"5":[[2,16]],"14":[[2,16]],"12":[[2,16]],"36":[[2,16]],"38":[[2,16]],"35":[[2,16]],"33":[[2,16]],"24":[[2,16]],"28":[[2,16]],"29":[[2,16]],"30":[[2,16]],"19":[[2,16]],"20":[[2,16]]},{"19":[[2,19]],"30":[[2,19]],"29":[[2,19]],"28":[[2,19]],"24":[[2,19]],"33":[[2,19]],"35":[[2,19]],"38":[[2,19]],"36":[[2,19]],"12":[[2,19]],"14":[[2,19]],"5":[[2,19]],"16":[[2,19]],"21":[[2,19]],"22":[[2,19]],"23":[[2,19]],"37":[[2,19]],"20":[[2,19]]},{"19":[[2,20]],"30":[[2,20]],"29":[[2,20]],"28":[[2,20]],"24":[[2,20]],"33":[[2,20]],"35":[[2,20]],"38":[[2,20]],"36":[[2,20]],"12":[[2,20]],"14":[[2,20]],"5":[[2,20]],"16":[[2,20]],"21":[[2,20]],"22":[[2,20]],"23":[[2,20]],"37":[[2,20]],"20":[[2,20]]},{"19":[[2,21]],"30":[[2,21]],"29":[[2,21]],"28":[[2,21]],"24":[[2,21]],"33":[[2,21]],"35":[[2,21]],"38":[[2,21]],"36":[[2,21]],"12":[[2,21]],"14":[[2,21]],"5":[[2,21]],"16":[[2,21]],"21":[[2,21]],"22":[[2,21]],"23":[[2,21]],"37":[[2,21]],"20":[[2,21]]},{"19":[[2,24]],"30":[[2,24]],"29":[[2,24]],"28":[[2,24]],"24":[[2,24]],"33":[[2,24]],"35":[[2,24]],"38":[[2,24]],"36":[[2,24]],"12":[[2,24]],"14":[[2,24]],"5":[[2,24]],"16":[[2,24]],"21":[[2,24]],"22":[[2,24]],"23":[[2,24]],"37":[[2,24]],"20":[[2,24]]},{"37":[[2,34]],"23":[[2,34]],"22":[[2,34]],"21":[[2,34]],"16":[[2,34]],"5":[[2,34]],"14":[[2,34]],"12":[[2,34]],"36":[[2,34]],"38":[[2,34]],"35":[[2,34]],"33":[[2,34]],"24":[[2,34]],"28":[[2,34]],"29":[[2,34]],"30":[[2,34]],"19":[[2,34]],"20":[[2,34]]},{"20":[[1,45]],"16":[[1,30]]},{"21":[[1,32]],"22":[[1,33]],"23":[[1,34]],"26":35,"37":[[1,36]],"19":[[2,22]],"30":[[2,22]],"29":[[2,22]],"28":[[2,22]],"24":[[2,22]],"33":[[2,22]],"35":[[2,22]],"38":[[2,22]],"36":[[2,22]],"12":[[2,22]],"14":[[2,22]],"5":[[2,22]],"16":[[2,22]],"20":[[2,22]]},{"34":[[1,46]]},{"7":[[1,47]]},{"1":[[2,2]]},{"5":[[2,9]],"7":[[2,9]],"36":[[2,9]],"38":[[2,9]],"35":[[2,9]],"33":[[2,9]],"19":[[2,9]],"24":[[2,9]],"28":[[2,9]],"29":[[2,9]],"30":[[2,9]]},{"30":[[2,11]],"29":[[2,11]],"28":[[2,11]],"24":[[2,11]],"19":[[2,11]],"33":[[2,11]],"35":[[2,11]],"38":[[2,11]],"36":[[2,11]],"7":[[2,11]],"5":[[2,11]]},{"16":[[1,30]],"12":[[2,14]],"14":[[2,14]],"5":[[2,14]],"20":[[2,14]]},{"19":[[2,18]],"30":[[2,18]],"29":[[2,18]],"28":[[2,18]],"24":[[2,18]],"33":[[2,18]],"35":[[2,18]],"38":[[2,18]],"36":[[2,18]],"12":[[2,18]],"14":[[2,18]],"5":[[2,18]],"16":[[2,18]],"21":[[2,18]],"22":[[2,18]],"23":[[2,18]],"37":[[2,18]],"20":[[2,18]]},{"23":[[2,31]],"22":[[2,31]],"21":[[2,31]],"16":[[2,31]],"5":[[2,31]],"14":[[2,31]],"12":[[2,31]],"36":[[2,31]],"38":[[2,31]],"35":[[2,31]],"33":[[2,31]],"24":[[2,31]],"28":[[2,31]],"29":[[2,31]],"30":[[2,31]],"19":[[2,31]],"37":[[2,31]],"20":[[2,31]]},{"1":[[2,1]]}],
116
+ parseError: function parseError(str, hash) {
117
+ throw new Error(str);
118
+ },
119
+ parse: function parse(input) {
120
+ var self = this, stack = [0], vstack = [null], table = this.table, yytext = "", yylineno = 0, yyleng = 0, shifts = 0, reductions = 0;
121
+ this.lexer.setInput(input);
122
+ this.lexer.yy = this.yy;
123
+ var parseError = this.yy.parseError = this.yy.parseError || this.parseError;
124
+
125
+ function lex() {
126
+ var token;
127
+ token = self.lexer.lex() || 1;
128
+ if (typeof token !== "number") {
129
+ token = self.symbols_[token];
130
+ }
131
+ return token;
132
+ }
133
+
134
+ var symbol, state, action, a, r, yyval = {}, p, len, ip = 0, newState, expected;
135
+ symbol = lex();
136
+ while (true) {
137
+ state = stack[stack.length - 1];
138
+ action = table[state] && table[state][symbol];
139
+ if (typeof action == "undefined" || !action.length || !action[0]) {
140
+ expected = [];
141
+ for (p in table[state]) {
142
+ if (this.terminals_[p] && p != 1) {
143
+ expected.push("'" + this.terminals_[p] + "'");
144
+ }
145
+ }
146
+ if (this.lexer.showPosition) {
147
+ parseError("Parse error on line " + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(", "), {text: this.lexer.match, token: this.terminals_[symbol], line: this.lexer.yylineno, expected: expected});
148
+ } else {
149
+ parseError("Parse error on line " + (yylineno + 1) + ": Unexpected '" + this.terminals_[symbol] + "'", {text: this.lexer.match, token: this.terminals_[symbol], line: this.lexer.yylineno, expected: expected});
150
+ }
151
+ }
152
+ this.trace("action:", action);
153
+ if (action.length > 1) {
154
+ throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
155
+ }
156
+ a = action[0];
157
+ switch (a[0]) {
158
+ case 1:
159
+ shifts++;
160
+ stack.push(symbol);
161
+ ++ip;
162
+ yyleng = this.lexer.yyleng;
163
+ yytext = this.lexer.yytext;
164
+ yylineno = this.lexer.yylineno;
165
+ symbol = lex();
166
+ vstack.push(null);
167
+ stack.push(a[1]);
168
+ break;
169
+ case 2:
170
+ reductions++;
171
+ len = this.productions_[a[1]][1];
172
+ yyval.$ = vstack[vstack.length - len];
173
+ r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, a[1], vstack);
174
+ if (typeof r !== "undefined") {
175
+ return r;
176
+ }
177
+ if (len) {
178
+ stack = stack.slice(0, -1 * len * 2);
179
+ vstack = vstack.slice(0, -1 * len);
180
+ }
181
+ stack.push(this.productions_[a[1]][0]);
182
+ vstack.push(yyval.$);
183
+ newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
184
+ stack.push(newState);
185
+ break;
186
+ case 3:
187
+ this.reductionCount = reductions;
188
+ this.shiftCount = shifts;
189
+ return true;
190
+ default:;
191
+ }
192
+ }
193
+ return true;
194
+ }};/* Jison generated lexer */
195
+ var lexer = (function(){var lexer = ({EOF:"",
196
+ parseError:function parseError(str, hash) {
197
+ if (this.yy.parseError) {
198
+ this.yy.parseError(str, hash);
199
+ } else {
200
+ throw new Error(str);
201
+ }
202
+ },
203
+ setInput:function (input) {
204
+ this._input = input;
205
+ this._more = this._less = this.done = false;
206
+ this.yylineno = this.yyleng = 0;
207
+ this.yytext = this.matched = this.match = "";
208
+ return this;
209
+ },
210
+ input:function () {
211
+ var ch = this._input[0];
212
+ this.yytext += ch;
213
+ this.yyleng++;
214
+ this.match += ch;
215
+ this.matched += ch;
216
+ var lines = ch.match(/\n/);
217
+ if (lines) {
218
+ this.yylineno++;
219
+ }
220
+ this._input = this._input.slice(1);
221
+ return ch;
222
+ },
223
+ unput:function (ch) {
224
+ this._input = ch + this._input;
225
+ return this;
226
+ },
227
+ more:function () {
228
+ this._more = true;
229
+ return this;
230
+ },
231
+ pastInput:function () {
232
+ var past = this.matched.substr(0, this.matched.length - this.match.length);
233
+ return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
234
+ },
235
+ upcomingInput:function () {
236
+ var next = this.match;
237
+ if (next.length < 20) {
238
+ next += this._input.substr(0, 20 - next.length);
239
+ }
240
+ return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
241
+ },
242
+ showPosition:function () {
243
+ var pre = this.pastInput();
244
+ var c = (new Array(pre.length + 1)).join("-");
245
+ return pre + this.upcomingInput() + "\n" + c + "^";
246
+ },
247
+ next:function () {
248
+ if (this.done) {
249
+ return this.EOF;
250
+ }
251
+ if (!this._input) {
252
+ this.done = true;
253
+ }
254
+ var token, match, lines;
255
+ if (!this._more) {
256
+ this.yytext = "";
257
+ this.match = "";
258
+ }
259
+ for (var i = 0; i < this.rules.length; i++) {
260
+ match = this._input.match(this.rules[i]);
261
+ if (match) {
262
+ lines = match[0].match(/\n/g);
263
+ if (lines) {
264
+ this.yylineno += lines.length;
265
+ }
266
+ this.yytext += match[0];
267
+ this.match += match[0];
268
+ this.matches = match;
269
+ this.yyleng = this.yytext.length;
270
+ this._more = false;
271
+ this._input = this._input.slice(match[0].length);
272
+ this.matched += match[0];
273
+ token = this.performAction.call(this, this.yy, this, i);
274
+ if (token) {
275
+ return token;
276
+ } else {
277
+ return;
278
+ }
279
+ }
280
+ }
281
+ if (this._input == this.EOF) {
282
+ return this.EOF;
283
+ } else {
284
+ this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {text: "", token: null, line: this.yylineno});
285
+ }
286
+ },
287
+ lex:function () {
288
+ var r = this.next();
289
+ if (typeof r !== "undefined") {
290
+ return r;
291
+ } else {
292
+ return this.lex();
293
+ }
294
+ }});
295
+ lexer.performAction = function anonymous(yy, yy_) {
296
+ switch (arguments[2]) {
297
+ case 0:
298
+ yy.freshLine = true;
299
+ break;
300
+ case 1:
301
+ if (yy.ruleSection) {
302
+ yy.freshLine = false;
303
+ }
304
+ break;
305
+ case 2:
306
+ yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 3);
307
+ return 14;
308
+ break;
309
+ case 3:
310
+ return 12;
311
+ break;
312
+ case 4:
313
+ yy_.yytext = yy_.yytext.replace(/\\"/g, "\"");
314
+ return 38;
315
+ break;
316
+ case 5:
317
+ yy_.yytext = yy_.yytext.replace(/\\'/g, "'");
318
+ return 38;
319
+ break;
320
+ case 6:
321
+ return 16;
322
+ break;
323
+ case 7:
324
+ return 35;
325
+ break;
326
+ case 8:
327
+ return 19;
328
+ break;
329
+ case 9:
330
+ return 20;
331
+ break;
332
+ case 10:
333
+ return 21;
334
+ break;
335
+ case 11:
336
+ return 22;
337
+ break;
338
+ case 12:
339
+ return 23;
340
+ break;
341
+ case 13:
342
+ return 29;
343
+ break;
344
+ case 14:
345
+ return 24;
346
+ break;
347
+ case 15:
348
+ return 36;
349
+ break;
350
+ case 16:
351
+ return 30;
352
+ break;
353
+ case 17:
354
+ return 30;
355
+ break;
356
+ case 18:
357
+ return 28;
358
+ break;
359
+ case 19:
360
+ yy.ruleSection = true;
361
+ return 5;
362
+ break;
363
+ case 20:
364
+ return 37;
365
+ break;
366
+ case 21:
367
+ if (yy.freshLine) {
368
+ this.input("{");
369
+ return 33;
370
+ } else {
371
+ this.unput("y");
372
+ }
373
+ break;
374
+ case 22:
375
+ return 34;
376
+ break;
377
+ case 23:
378
+ yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4);
379
+ return 14;
380
+ break;
381
+ case 24:
382
+ break;
383
+ case 25:
384
+ return 7;
385
+ break;
386
+ default:;
387
+ }
388
+ };
389
+ lexer.rules = [/^\n+/, /^\s+/, /^y\{[^}]*\}/, /^[a-zA-Z_][a-zA-Z0-9_-]*/, /^"(\\\\|\\"|[^"])*"/, /^'(\\\\|\\'|[^'])*'/, /^\|/, /^\[(\\\]|[^\]])*\]/, /^\(/, /^\)/, /^\+/, /^\*/, /^\?/, /^\^/, /^\//, /^\\[a-zA-Z0]/, /^\$/, /^<<EOF>>/, /^\./, /^%%/, /^\{\d+(,\s?\d+|,)?\}/, /^(?=\{)/, /^\}/, /^%\{(.|\n)*?%\}/, /^./, /^$/];return lexer;})()
390
+ parser.lexer = lexer;
391
+ return parser;
392
+ })();
393
+ if (typeof require !== 'undefined') {
394
+ exports.parser = jisonlex;
395
+ exports.parse = function () { return jisonlex.parse.apply(jisonlex, arguments); }
396
+ exports.main = function commonjsMain(args) {
397
+ var cwd = require("file").path(require("file").cwd());
398
+ if (!args[1]) {
399
+ throw new Error("Usage: " + args[0] + " FILE");
400
+ }
401
+ var source = cwd.join(args[1]).read({charset: "utf-8"});
402
+ this.parse(source);
403
+ }
404
+ if (require.main === module) {
405
+ exports.main(require("system").args);
406
+ }
407
+ }
@@ -0,0 +1,94 @@
1
+ // Set class to wrap arrays
2
+
3
+ if (typeof require !== 'undefined')
4
+ var typal = require("./typal").typal;
5
+
6
+ var setMixin = {
7
+ constructor: function Set_constructor (set, raw) {
8
+ this._items = [];
9
+ if (set && set.constructor === Array)
10
+ this._items = raw ? set: set.slice(0);
11
+ else if(arguments.length)
12
+ this._items = [].slice.call(arguments,0);
13
+ },
14
+ concat: function concat (setB) {
15
+ this._items.push.apply(this._items, setB._items || setB);
16
+ return this;
17
+ },
18
+ eq: function eq (set) {
19
+ return this._items.length === set._items.length && this.subset(set);
20
+ },
21
+ indexOf: function indexOf (item) {
22
+ if(item && item.eq) {
23
+ for(var k=0; k<this._items.length;k++)
24
+ if(item.eq(this._items[k]))
25
+ return k;
26
+ return -1;
27
+ }
28
+ return this._items.indexOf(item);
29
+ },
30
+ union: function union (set) {
31
+ return (new Set(this._items)).concat(this.complement(set));
32
+ },
33
+ intersection: function intersection (set) {
34
+ return this.filter(function (elm) {
35
+ return set.contains(elm);
36
+ });
37
+ },
38
+ complement: function complement (set) {
39
+ var that = this;
40
+ return set.filter(function sub_complement (elm) {
41
+ return !that.contains(elm);
42
+ });
43
+ },
44
+ subset: function subset (set) {
45
+ var cont = true;
46
+ for (var i=0; i<this._items.length && cont;i++) {
47
+ cont = cont && set.contains(this._items[i]);
48
+ };
49
+ return cont;
50
+ },
51
+ superset: function superset (set) {
52
+ return set.subset(this);
53
+ },
54
+ joinSet: function joinSet (set) {
55
+ return this.concat(this.complement(set));
56
+ },
57
+ contains: function contains (item) { return this.indexOf(item) !== -1; },
58
+ item: function item (v, val) { return this._items[v]; },
59
+ i: function i (v, val) { return this._items[v]; },
60
+ first: function first () { return this._items[0]; },
61
+ last: function last () { return this._items[this._items.length-1]; },
62
+ size: function size () { return this._items.length; },
63
+ isEmpty: function isEmpty () { return this._items.length === 0; },
64
+ copy: function copy () { return new Set(this._items); },
65
+ toString: function toString () { return this._items.toString(); }
66
+ };
67
+
68
+ "push shift unshift forEach some every join sort".split(' ').forEach(function (e,i) {
69
+ setMixin[e] = function () { return Array.prototype[e].apply(this._items, arguments); };
70
+ setMixin[e].name = e;
71
+ });
72
+ "filter slice map".split(' ').forEach(function (e,i) {
73
+ setMixin[e] = function () { return new Set(Array.prototype[e].apply(this._items, arguments), true); };
74
+ setMixin[e].name = e;
75
+ });
76
+
77
+ var Set = typal.construct(setMixin).mix({
78
+ union: function (a, b) {
79
+ var ar = {};
80
+ for (var k=a.length-1;k >=0;--k) {
81
+ ar[a[k]] = true;
82
+ }
83
+ for (var i=b.length-1;i >= 0;--i) {
84
+ if (!ar[b[i]]) {
85
+ a.push(b[i]);
86
+ }
87
+ }
88
+ return a;
89
+ }
90
+ });
91
+
92
+ if (typeof exports !== 'undefined')
93
+ exports.Set = Set;
94
+
@@ -0,0 +1,90 @@
1
+ /*
2
+ * Introduces a typal object to make classical/prototypal patterns easier
3
+ * Plus some AOP sugar
4
+ *
5
+ * By Zachary Carter <zach@carter.name>
6
+ * MIT Licensed
7
+ * */
8
+
9
+ var typal = (function () {
10
+
11
+ var create = Object.create || function (o) { function F(){}; F.prototype = o; return new F(); };
12
+ var position = /^(before|after)/;
13
+
14
+ // basic method layering
15
+ // always returns original method's return value
16
+ function layerMethod(k, fun) {
17
+ var pos = k.match(position)[0],
18
+ key = k.replace(position, ''),
19
+ prop = this[key];
20
+
21
+ if (pos === 'after') {
22
+ this[key] = function () {
23
+ var ret = prop.apply(this, arguments);
24
+ var args = [].slice.call(arguments);
25
+ args.splice(0, 0, ret);
26
+ fun.apply(this, args);
27
+ return ret;
28
+ }
29
+ } else if (pos === 'before') {
30
+ this[key] = function () {
31
+ fun.apply(this, arguments);
32
+ var ret = prop.apply(this, arguments);
33
+ return ret;
34
+ }
35
+ }
36
+ }
37
+
38
+ // mixes each argument's own properties into calling object,
39
+ // overwriting them or layering them. i.e. an object method 'meth' is
40
+ // layered by mixin methods 'beforemeth' or 'aftermeth'
41
+ function typal_mix() {
42
+ var self = this;
43
+ for(var i=0,o,k; i<arguments.length; i++) {
44
+ o=arguments[i];
45
+ if (!o) continue;
46
+ if (Object.prototype.hasOwnProperty.call(o,'constructor'))
47
+ this.constructor = o.constructor;
48
+ if (Object.prototype.hasOwnProperty.call(o,'toString'))
49
+ this.toString = o.toString;
50
+ for(k in o) {
51
+ if (Object.prototype.hasOwnProperty.call(o, k)) {
52
+ if(k.match(position) && typeof this[k.replace(position, '')] === 'function')
53
+ layerMethod.call(this, k, o[k]);
54
+ else
55
+ this[k] = o[k];
56
+ }
57
+ }
58
+ }
59
+ return this;
60
+ }
61
+
62
+ return {
63
+ // extend object with own typalperties of each argument
64
+ mix: typal_mix,
65
+
66
+ // sugar for object begetting and mixing
67
+ // - Object.create(typal).mix(etc, etc);
68
+ // + typal.beget(etc, etc);
69
+ beget: function typal_beget() {
70
+ return arguments.length ? typal_mix.apply(create(this), arguments) : create(this);
71
+ },
72
+
73
+ // Creates a new Class function based on an object with a constructor method
74
+ construct: function typal_construct() {
75
+ var o = typal_mix.apply(create(this), arguments);
76
+ var constructor = o.constructor;
77
+ var Klass = o.constructor = function () { return constructor.apply(this, arguments); };
78
+ Klass.prototype = o;
79
+ Klass.mix = typal_mix; // allow for easy singleton property extension
80
+ return Klass;
81
+ },
82
+
83
+ // no op
84
+ constructor: function typal_constructor() { return this; }
85
+ };
86
+
87
+ })();
88
+
89
+ if (typeof exports !== 'undefined')
90
+ exports.typal = typal;