fancy 0.3.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 (242) hide show
  1. data/AUTHORS +7 -0
  2. data/LICENSE +19 -0
  3. data/README +173 -0
  4. data/Rakefile +255 -0
  5. data/bin/fancy +40 -0
  6. data/bin/fdoc +23 -0
  7. data/bin/fyi +22 -0
  8. data/bin/ifancy +46 -0
  9. data/boot/README +12 -0
  10. data/boot/code_loader.rb +165 -0
  11. data/boot/compile.fy +3 -0
  12. data/boot/fancy_ext.rb +13 -0
  13. data/boot/fancy_ext/block_env.rb +29 -0
  14. data/boot/fancy_ext/class.rb +26 -0
  15. data/boot/fancy_ext/kernel.rb +12 -0
  16. data/boot/fancy_ext/module.rb +89 -0
  17. data/boot/fancy_ext/object.rb +34 -0
  18. data/boot/fancy_ext/string_helper.rb +10 -0
  19. data/boot/load.rb +72 -0
  20. data/boot/rbx-compiler/README +12 -0
  21. data/boot/rbx-compiler/compiler.rb +24 -0
  22. data/boot/rbx-compiler/compiler/ast.rb +23 -0
  23. data/boot/rbx-compiler/compiler/ast/README +11 -0
  24. data/boot/rbx-compiler/compiler/ast/array_literal.rb +13 -0
  25. data/boot/rbx-compiler/compiler/ast/assign.rb +57 -0
  26. data/boot/rbx-compiler/compiler/ast/block.rb +70 -0
  27. data/boot/rbx-compiler/compiler/ast/class_def.rb +35 -0
  28. data/boot/rbx-compiler/compiler/ast/expression_list.rb +57 -0
  29. data/boot/rbx-compiler/compiler/ast/hash_literal.rb +11 -0
  30. data/boot/rbx-compiler/compiler/ast/identifier.rb +120 -0
  31. data/boot/rbx-compiler/compiler/ast/match.rb +81 -0
  32. data/boot/rbx-compiler/compiler/ast/message_send.rb +71 -0
  33. data/boot/rbx-compiler/compiler/ast/method_def.rb +116 -0
  34. data/boot/rbx-compiler/compiler/ast/node.rb +6 -0
  35. data/boot/rbx-compiler/compiler/ast/range_literal.rb +22 -0
  36. data/boot/rbx-compiler/compiler/ast/require.rb +20 -0
  37. data/boot/rbx-compiler/compiler/ast/return.rb +29 -0
  38. data/boot/rbx-compiler/compiler/ast/ruby_args.rb +35 -0
  39. data/boot/rbx-compiler/compiler/ast/script.rb +56 -0
  40. data/boot/rbx-compiler/compiler/ast/singleton_method_def.rb +39 -0
  41. data/boot/rbx-compiler/compiler/ast/string_literal.rb +14 -0
  42. data/boot/rbx-compiler/compiler/ast/super.rb +25 -0
  43. data/boot/rbx-compiler/compiler/ast/try_catch_block.rb +220 -0
  44. data/boot/rbx-compiler/compiler/ast/tuple_literal.rb +33 -0
  45. data/boot/rbx-compiler/compiler/command.rb +39 -0
  46. data/boot/rbx-compiler/compiler/compiler.rb +83 -0
  47. data/boot/rbx-compiler/compiler/stages.rb +99 -0
  48. data/boot/rbx-compiler/parser.rb +2 -0
  49. data/boot/rbx-compiler/parser/README +15 -0
  50. data/boot/rbx-compiler/parser/Rakefile +54 -0
  51. data/boot/rbx-compiler/parser/extconf.rb +3 -0
  52. data/boot/rbx-compiler/parser/fancy_parser.bundle +0 -0
  53. data/boot/rbx-compiler/parser/fancy_parser.c +46 -0
  54. data/boot/rbx-compiler/parser/fancy_parser.h +8 -0
  55. data/boot/rbx-compiler/parser/lexer.lex +180 -0
  56. data/boot/rbx-compiler/parser/parser.rb +356 -0
  57. data/boot/rbx-compiler/parser/parser.y +711 -0
  58. data/boot/rsexp_pretty_printer.rb +76 -0
  59. data/doc/api/fancy.css +93 -0
  60. data/doc/api/fancy.jsonp +1 -0
  61. data/doc/api/fdoc.js +187 -0
  62. data/doc/api/index.html +57 -0
  63. data/doc/api/underscore-min.js +18 -0
  64. data/doc/features.md +228 -0
  65. data/examples/argv.fy +8 -0
  66. data/examples/arithmetic.fy +7 -0
  67. data/examples/armstrong_numbers.fy +33 -0
  68. data/examples/array.fy +52 -0
  69. data/examples/blocks.fy +15 -0
  70. data/examples/boolean.fy +24 -0
  71. data/examples/call_with_receiver.fy +9 -0
  72. data/examples/class.fy +68 -0
  73. data/examples/closures.fy +24 -0
  74. data/examples/constant_access.fy +15 -0
  75. data/examples/default_args.fy +17 -0
  76. data/examples/define_methods.fy +15 -0
  77. data/examples/documentation.fy +57 -0
  78. data/examples/documentation_formatters.fy +25 -0
  79. data/examples/echo.fy +16 -0
  80. data/examples/empty_catch.fy +4 -0
  81. data/examples/exception.fy +9 -0
  82. data/examples/factorial.fy +12 -0
  83. data/examples/fibonacci.fy +16 -0
  84. data/examples/files.fy +23 -0
  85. data/examples/finally.fy +5 -0
  86. data/examples/game_of_life.fy +148 -0
  87. data/examples/hashes.fy +7 -0
  88. data/examples/hello_world.fy +6 -0
  89. data/examples/html_generator.fy +54 -0
  90. data/examples/implicit_return.fy +3 -0
  91. data/examples/matchers.fy +6 -0
  92. data/examples/methods.fy +29 -0
  93. data/examples/nested_classes.fy +27 -0
  94. data/examples/nested_try.fy +9 -0
  95. data/examples/numbers.fy +12 -0
  96. data/examples/pattern_matching.fy +40 -0
  97. data/examples/person.fy +65 -0
  98. data/examples/project-euler/01.fy +8 -0
  99. data/examples/project-euler/02.fy +21 -0
  100. data/examples/project-euler/28.fy +33 -0
  101. data/examples/rbx/and_or.fy +7 -0
  102. data/examples/rbx/blocks.fy +22 -0
  103. data/examples/rbx/classes.fy +32 -0
  104. data/examples/rbx/hello.fy +8 -0
  105. data/examples/rbx/include.fy +12 -0
  106. data/examples/rbx/inherit.fy +11 -0
  107. data/examples/rbx/methods.fy +15 -0
  108. data/examples/rbx/nested_classes.fy +9 -0
  109. data/examples/rbx/require.fy +3 -0
  110. data/examples/rbx/strings.fy +5 -0
  111. data/examples/regex.fy +7 -0
  112. data/examples/require.fy +7 -0
  113. data/examples/retry.fy +12 -0
  114. data/examples/return.fy +13 -0
  115. data/examples/ruby_require.fy +7 -0
  116. data/examples/ruby_send.fy +3 -0
  117. data/examples/singleton_methods.fy +21 -0
  118. data/examples/stupid_quicksort.fy +12 -0
  119. data/examples/threads.fy +18 -0
  120. data/examples/tuple.fy +8 -0
  121. data/examples/webserver/webserver.fy +18 -0
  122. data/lib/argv.fy +36 -0
  123. data/lib/array.fy +207 -0
  124. data/lib/block.fy +88 -0
  125. data/lib/boot.fy +41 -0
  126. data/lib/class.fy +106 -0
  127. data/lib/compiler.fy +14 -0
  128. data/lib/compiler/ast.fy +40 -0
  129. data/lib/compiler/ast/assign.fy +96 -0
  130. data/lib/compiler/ast/block.fy +84 -0
  131. data/lib/compiler/ast/class_def.fy +33 -0
  132. data/lib/compiler/ast/expression_list.fy +47 -0
  133. data/lib/compiler/ast/identifier.fy +113 -0
  134. data/lib/compiler/ast/literals.fy +122 -0
  135. data/lib/compiler/ast/match.fy +88 -0
  136. data/lib/compiler/ast/message_send.fy +110 -0
  137. data/lib/compiler/ast/method_def.fy +90 -0
  138. data/lib/compiler/ast/node.fy +7 -0
  139. data/lib/compiler/ast/range.fy +16 -0
  140. data/lib/compiler/ast/require.fy +15 -0
  141. data/lib/compiler/ast/return.fy +23 -0
  142. data/lib/compiler/ast/script.fy +52 -0
  143. data/lib/compiler/ast/singleton_method_def.fy +35 -0
  144. data/lib/compiler/ast/super.fy +17 -0
  145. data/lib/compiler/ast/try_catch.fy +176 -0
  146. data/lib/compiler/ast/tuple_literal.fy +34 -0
  147. data/lib/compiler/command.fy +51 -0
  148. data/lib/compiler/compiler.fy +73 -0
  149. data/lib/compiler/stages.fy +81 -0
  150. data/lib/directory.fy +17 -0
  151. data/lib/documentation.fy +115 -0
  152. data/lib/enumerable.fy +269 -0
  153. data/lib/eval.fy +31 -0
  154. data/lib/fancy_spec.fy +202 -0
  155. data/lib/fdoc.fy +359 -0
  156. data/lib/fdoc_hook.fy +10 -0
  157. data/lib/file.fy +54 -0
  158. data/lib/hash.fy +56 -0
  159. data/lib/main.fy +80 -0
  160. data/lib/method.fy +22 -0
  161. data/lib/nil_class.fy +56 -0
  162. data/lib/number.fy +87 -0
  163. data/lib/object.fy +170 -0
  164. data/lib/package.fy +61 -0
  165. data/lib/package/dependency.fy +24 -0
  166. data/lib/package/installer.fy +180 -0
  167. data/lib/package/specification.fy +55 -0
  168. data/lib/package/uninstaller.fy +15 -0
  169. data/lib/parser.fy +4 -0
  170. data/lib/parser/ext/README +15 -0
  171. data/lib/parser/ext/ext.c +42 -0
  172. data/lib/parser/ext/ext.h +8 -0
  173. data/lib/parser/ext/extconf.rb +3 -0
  174. data/lib/parser/ext/lexer.lex +187 -0
  175. data/lib/parser/ext/parser.y +744 -0
  176. data/lib/parser/methods.fy +297 -0
  177. data/lib/rbx.fy +37 -0
  178. data/lib/rbx/array.fy +237 -0
  179. data/lib/rbx/bignum.fy +23 -0
  180. data/lib/rbx/block.fy +9 -0
  181. data/lib/rbx/class.fy +129 -0
  182. data/lib/rbx/code_loader.fy +192 -0
  183. data/lib/rbx/console.fy +63 -0
  184. data/lib/rbx/directory.fy +46 -0
  185. data/lib/rbx/documentation.fy +64 -0
  186. data/lib/rbx/environment_variables.fy +3 -0
  187. data/lib/rbx/exception.fy +30 -0
  188. data/lib/rbx/false_class.fy +58 -0
  189. data/lib/rbx/fiber.fy +25 -0
  190. data/lib/rbx/file.fy +191 -0
  191. data/lib/rbx/fixnum.fy +25 -0
  192. data/lib/rbx/float.fy +14 -0
  193. data/lib/rbx/hash.fy +38 -0
  194. data/lib/rbx/integer.fy +15 -0
  195. data/lib/rbx/io.fy +30 -0
  196. data/lib/rbx/match_data.fy +9 -0
  197. data/lib/rbx/method.fy +22 -0
  198. data/lib/rbx/name_error.fy +3 -0
  199. data/lib/rbx/no_method_error.fy +15 -0
  200. data/lib/rbx/object.fy +117 -0
  201. data/lib/rbx/range.fy +15 -0
  202. data/lib/rbx/regexp.fy +9 -0
  203. data/lib/rbx/string.fy +63 -0
  204. data/lib/rbx/symbol.fy +12 -0
  205. data/lib/rbx/system.fy +37 -0
  206. data/lib/rbx/tcp_server.fy +6 -0
  207. data/lib/rbx/tcp_socket.fy +7 -0
  208. data/lib/rbx/thread.fy +75 -0
  209. data/lib/rbx/tuple.fy +37 -0
  210. data/lib/set.fy +61 -0
  211. data/lib/stack.fy +51 -0
  212. data/lib/string.fy +58 -0
  213. data/lib/struct.fy +13 -0
  214. data/lib/symbol.fy +23 -0
  215. data/lib/true_class.fy +43 -0
  216. data/lib/tuple.fy +68 -0
  217. data/lib/version.fy +6 -0
  218. data/tests/argv.fy +13 -0
  219. data/tests/array.fy +343 -0
  220. data/tests/assignment.fy +53 -0
  221. data/tests/block.fy +103 -0
  222. data/tests/class.fy +409 -0
  223. data/tests/control_flow.fy +79 -0
  224. data/tests/documentation.fy +24 -0
  225. data/tests/exception.fy +115 -0
  226. data/tests/file.fy +86 -0
  227. data/tests/hash.fy +101 -0
  228. data/tests/method.fy +131 -0
  229. data/tests/nil_class.fy +55 -0
  230. data/tests/number.fy +128 -0
  231. data/tests/object.fy +125 -0
  232. data/tests/parsing/sexp.fy +50 -0
  233. data/tests/pattern_matching.fy +82 -0
  234. data/tests/range.fy +11 -0
  235. data/tests/set.fy +10 -0
  236. data/tests/stack.fy +22 -0
  237. data/tests/string.fy +102 -0
  238. data/tests/symbol.fy +17 -0
  239. data/tests/true_class.fy +63 -0
  240. data/tests/tuple.fy +21 -0
  241. data/tools/fancy-mode.el +63 -0
  242. metadata +321 -0
data/tests/set.fy ADDED
@@ -0,0 +1,10 @@
1
+ FancySpec describe: Set with: {
2
+ it: "should only keep unique values" for: "[]" when: {
3
+ s = Set new
4
+ s << 'foo
5
+ s << 'foo
6
+ s size should == 1
7
+ s should == (Set[['foo]])
8
+ s should_not == ['foo] # Sets and Arrays differ
9
+ }
10
+ }
data/tests/stack.fy ADDED
@@ -0,0 +1,22 @@
1
+ FancySpec describe: Stack with: {
2
+ it: "should be empty when created" for: '<< when: {
3
+ s = Stack new
4
+ s empty? should == true
5
+ }
6
+
7
+ it: "should return the last inserted element" for: 'pop when: {
8
+ s = Stack new
9
+ s push: 1
10
+ s pop should == 1
11
+
12
+ objs = [1,2,3]
13
+ objs each: |x| {
14
+ s push: x
15
+ }
16
+
17
+ objs reverse each: |x| {
18
+ s pop should == x
19
+ }
20
+
21
+ }
22
+ }
data/tests/string.fy ADDED
@@ -0,0 +1,102 @@
1
+ FancySpec describe: String with: {
2
+ it: "should be the empty string on initialization" when: {
3
+ str = String new
4
+ str should == ""
5
+ }
6
+
7
+ it: "should be the concatination of the strings" for: '+ when: {
8
+ str1 = "hello "
9
+ str2 = "world"
10
+ str3 = "!"
11
+ str1 + str2 + str3 should == "hello world!"
12
+ }
13
+
14
+ it: "should concatenate the argument's string value with a string" for: '++ when: {
15
+ "I'm " ++ 21 ++ " years old!" should == "I'm 21 years old!"
16
+ }
17
+
18
+ it: "should return the correct substring" for: 'from:to: when: {
19
+ "hello, world" from: 2 to: 5 . should == "llo,"
20
+ "hello, world"[[2,5]] . should == "llo,"
21
+ }
22
+
23
+ it: "should return the upcased string" for: 'upcase when: {
24
+ "hello, world" upcase should == "HELLO, WORLD"
25
+ }
26
+
27
+ it: "should return the downcased string" for: 'downcase when: {
28
+ "HELLO, WORLD" downcase should == "hello, world"
29
+ }
30
+
31
+ it: "should return the same string by down- and upcasing in a row" when: {
32
+ "HELLO, WORLD" downcase upcase should == "HELLO, WORLD"
33
+ }
34
+
35
+ it: "should iterate over each character in a string" for: 'each: when: {
36
+ str = "Hello, World!"
37
+ i = 0
38
+ str each: |char| {
39
+ char should == (str at: i)
40
+ i = i + 1
41
+ }
42
+ }
43
+
44
+ it: "should behave like a collection/sequence via each:" for: 'uniq when: {
45
+ str = "Hello, World!"
46
+ str uniq join: "" . should == "Helo, Wrd!"
47
+ }
48
+
49
+ it: "should have all its characters as instances of String class" for: 'all?: when: {
50
+ str = "foo bar baz"
51
+ str all?: |c| { c is_a?: String } . should == true
52
+ }
53
+
54
+ # it: "should drop all characters upto a whitespace" for: 'drop_while: when: {
55
+ # "hello world" drop_while: |c| { c != " " } . join: "" . should == " world"
56
+ # }
57
+
58
+ it: "should be empty" for: 'empty? when: {
59
+ "" empty? should == true
60
+ " " empty? should == false
61
+ String new empty? should == true
62
+ }
63
+
64
+ # it: "should be blank" for: 'blank? when: {
65
+ # "" blank? should == true
66
+ # " " blank? should == true
67
+ # "-" blank? should == false
68
+ # " " blank? should == true
69
+ # "hello world" blank? should == false
70
+ # "hello world" at: 5 . blank? should == true
71
+ # }
72
+
73
+ # it: "should be evaled as fancy code and return the correct value" when: {
74
+ # x = "'foo" eval
75
+ # x should == 'foo
76
+ # "3 + 4" eval should == 7
77
+ # "'foo to_s upcase" eval should == "FOO"
78
+ # "33.33" eval should == 33.33
79
+ # }
80
+
81
+ it: "should return itself times n" for: '* when: {
82
+ "foo" * 2 should == "foofoo"
83
+ "f" ++ ("o" * 2) ++ "bar" should == "foobar"
84
+ }
85
+
86
+ it: "should split a string at a given seperator string" for: 'split: when: {
87
+ str = "hello, world, how are you?"
88
+ str split: ", " . should == ["hello", "world", "how are you?"]
89
+ "1,2,3,,4,5" split: "," . should == ["1", "2", "3", "", "4", "5"]
90
+ ",1,2,3,4," split: "," . should == ["", "1", "2", "3", "4"]
91
+ "foo bar\n baz yo" split should == ["foo", "bar", "baz", "yo"]
92
+ "foo bar\n baz yo" words should == ["foo", "bar", "baz", "yo"]
93
+ }
94
+
95
+ it: "should support basic string interpolation" when: {
96
+ "hello, #{10 * 10} world!" should == "hello, 100 world!"
97
+ x = "world"
98
+ "hello, #{x}!!" should == "hello, world!!"
99
+
100
+ "hello, #{x}, Fancy #{'rocks to_s upcase}!!" should == "hello, world, Fancy ROCKS!!"
101
+ }
102
+ }
data/tests/symbol.fy ADDED
@@ -0,0 +1,17 @@
1
+ FancySpec describe: Symbol with: {
2
+ it: "should be usable like a block for Enumerable methods" when: {
3
+ [1,2,3,4,5] map: 'squared .
4
+ should == [1,4,9,16,25]
5
+
6
+ ["hello", "world"] map: 'upcase .
7
+ should == ["HELLO", "WORLD"]
8
+
9
+ [1,2,3,4,5] select: 'even? .
10
+ should == [2,4]
11
+ }
12
+
13
+ it: "should evaluate itself within the current scope" when: {
14
+ x = 10
15
+ 'x eval should == x
16
+ }
17
+ }
@@ -0,0 +1,63 @@
1
+ FancySpec describe: TrueClass with: {
2
+ it: "should be true for calling and: with non-nil value" for: 'and: when: {
3
+ true and: true . should == true
4
+ true and: 'bar . should == true
5
+ }
6
+
7
+ it: "should be false for calling and: with a nil value" for: 'and: when: {
8
+ true and: nil . should == false
9
+ }
10
+
11
+ it: "should be true for calling && with non-nil value" for: '&& when: {
12
+ (true && true) should == true
13
+ (true && 'bar) should == true
14
+ }
15
+
16
+ it: "should be false for calling && with a nil value" for: '&& when: {
17
+ (true && nil) should == false
18
+ }
19
+
20
+ it: "should be true for calling or: with both non-nil values" for: 'or: when: {
21
+ true or: true . should == true
22
+ }
23
+
24
+ it: "should be true for calling or: with any values" for: 'or: when: {
25
+ true or: nil . should == true
26
+ true or: true . should == true
27
+ true or: 'foo . should == true
28
+ }
29
+
30
+ it: "should be true for calling || with both non-nil values" for: '|| when: {
31
+ (true || true) should == true
32
+ }
33
+
34
+ it: "should be true for calling || with any values" for: '|| when: {
35
+ (true || nil) should == true
36
+ (true || true) should == true
37
+ (true || 'foo) should == true
38
+ }
39
+
40
+ it: "should call the then-block" for: 'if_true:else: when: {
41
+ true if_true: { 'then } else: { 'else } . should == 'then
42
+ }
43
+
44
+ it: "should NOT call the block" for: 'if_false: when: {
45
+ true if_false: { 'false } . should == nil
46
+ }
47
+
48
+ it: "should NOT be nil" for: 'nil? when: {
49
+ true nil? should == false
50
+ }
51
+
52
+ it: "should NOT be false" for: 'false? when: {
53
+ true false? should == false
54
+ }
55
+
56
+ it: "should be true" for: 'true? when: {
57
+ true true? should == true
58
+ }
59
+
60
+ it: "should NOT call the block if true" for: 'if_nil: when: {
61
+ true if_nil: { 'is_nil } . should == nil
62
+ }
63
+ }
data/tests/tuple.fy ADDED
@@ -0,0 +1,21 @@
1
+ FancySpec describe: Tuple with: {
2
+ it: "have the correct amount of elements" for: 'size when: {
3
+ (1,2) size should == 2
4
+ (1,2,3) size should == 3
5
+ ('foo, "bar", 'baz, 123) size should == 4
6
+ }
7
+
8
+ it: "should have the correct items at a given index" for: 'at: when: {
9
+ tuple = ("foo", 'bar, "baz")
10
+ tuple at: 0 . should == "foo"
11
+ tuple at: 1 . should == 'bar
12
+ tuple at: 2 . should == "baz"
13
+ }
14
+
15
+ it: "should have the correct items at a given index" for: '[] when: {
16
+ tuple = ("foo", 'bar, "baz")
17
+ tuple[0] . should == "foo"
18
+ tuple[1] . should == 'bar
19
+ tuple[2] . should == "baz"
20
+ }
21
+ }
@@ -0,0 +1,63 @@
1
+ (require 'generic-x)
2
+
3
+ (define-generic-mode
4
+ 'fancy-mode
5
+ '("#") ;; comments
6
+ '("def" "class" "try" "catch"
7
+ "finally" "retry" "return"
8
+ "return_local" "require:"
9
+ "match" "case" "->" "=>") ;; keywords
10
+
11
+ '(;; symbols
12
+ ("\\('\\(\\([^\s\n]+\\|\\]+\\)\\)\\)" 1 font-lock-reference-face)
13
+ ;; fixnums
14
+ ("[0-9]+" . 'font-lock-variable-name-face)
15
+ ;; floats
16
+ ("[0-9]+\.[0-9]+" 'font-lock-variable-name-face)
17
+ ;; variables & pseudo variables
18
+ ("\\(^\\|[^_:.@$]\\|\\.\\.\\)\\b\\(super\\|nil\\|self\\|true\\|false\\)\\>" 2 font-lock-variable-name-face)
19
+ ;; variable names
20
+ ("\\(\\$\\([^a-zA-Z0-9 \n]\\|[0-9]\\)\\)\\W" 1 font-lock-variable-name-face)
21
+ ;; instance & class vars
22
+ ("\\(\\$\\|@\\|@@\\)\\(\\w\\|_\\)+" 0 font-lock-variable-name-face)
23
+ ;; method definitions
24
+ ("^\\s *def\\s +\\([^( \t\n]+\\)" 1 font-lock-function-name-face)
25
+ ;; message selectors
26
+ (" \\<[A-z][A-z0-9_-+?!=*/^><%]*:" . font-lock-function-name-face)
27
+ ;; operators
28
+ ("\\([-+*/~,<>=&!?%^]+ \\)" 1 'font-lock-function-name-face)
29
+ ;; general delimited string
30
+ ("\\(^\\|[[ \t\n<+(,=]\\)\\(%[xrqQwW]?\\([^<[{(a-zA-Z0-9 \n]\\)[^\n\\\\]*\\(\\\\.[^\n\\\\]*\\)*\\(\\3\\)\\)" (2 font-lock-string-face))
31
+ ;; constants
32
+ ("\\(^\\|[^_]\\)\\b\\([A-Z]+\\(\\w\\|_\\)*\\)" 2 font-lock-type-face))
33
+
34
+ '("\\.fy$") ;; files for which to activate this mode
35
+ nil ;; other functions to call
36
+ "A mode for fancy files" ;; doc string for this mode
37
+ )
38
+
39
+ (add-to-list 'auto-mode-alist '("\\.fy\\'" . fancy-mode))
40
+ (add-to-list 'auto-mode-alist '("\\.fancypack\\'" . fancy-mode))
41
+
42
+ ;; Ignore .fyc (compiled fancy bytecode) files
43
+ (add-to-list 'completion-ignored-extensions ".fyc")
44
+
45
+ (setq-default indent-tabs-mode nil)
46
+ (setq-default tab-width 2)
47
+ (setq indent-line-function 'insert-tab)
48
+
49
+ (setq do-indent nil)
50
+ (defun fancy-indent-line ()
51
+ ;(indent-line-to (+ (current-indentation) 2)))
52
+ (progn
53
+ (if (= (current-indentation) 0)
54
+ (setq do-indent nil))
55
+ (if do-indent
56
+ (indent-line-to (+ (current-indentation) 2))
57
+ (progn
58
+ (indent-relative)
59
+ (setq do-indent t)))))
60
+
61
+ (setq indent-line-function 'fancy-indent-line)
62
+
63
+ (provide 'fancy-mode)
metadata ADDED
@@ -0,0 +1,321 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fancy
3
+ version: !ruby/object:Gem::Version
4
+ hash: 19
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 3
9
+ - 0
10
+ version: 0.3.0
11
+ platform: ruby
12
+ authors:
13
+ - Christopher Bertels
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-02-01 00:00:00 -08:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description: |
23
+ The Fancy Programming Language
24
+
25
+ Fancy is a fully self-hosted, dynamic, pure class-based
26
+ object-oriented programming language heavily inspired by Smalltalk,
27
+ Ruby and Erlang. It supports dynamic code evaluation (as in Ruby &
28
+ Smalltalk), class-based mixins, generic pattern matching, runtime
29
+ introspection & reflection, "monkey patching" and much more. It runs
30
+ on Rubinius, the Ruby VM, and thus has first-class integration with
31
+ Ruby's core library and any additional Ruby libraries that run on
32
+ Rubinius, including most C-extensions.
33
+
34
+ email: chris@fancy-lang.org
35
+ executables:
36
+ - fancy
37
+ - ifancy
38
+ - fdoc
39
+ - fyi
40
+ extensions: []
41
+
42
+ extra_rdoc_files: []
43
+
44
+ files:
45
+ - README
46
+ - LICENSE
47
+ - AUTHORS
48
+ - Rakefile
49
+ - lib/argv.fy
50
+ - lib/array.fy
51
+ - lib/block.fy
52
+ - lib/boot.fy
53
+ - lib/class.fy
54
+ - lib/compiler/ast/assign.fy
55
+ - lib/compiler/ast/block.fy
56
+ - lib/compiler/ast/class_def.fy
57
+ - lib/compiler/ast/expression_list.fy
58
+ - lib/compiler/ast/identifier.fy
59
+ - lib/compiler/ast/literals.fy
60
+ - lib/compiler/ast/match.fy
61
+ - lib/compiler/ast/message_send.fy
62
+ - lib/compiler/ast/method_def.fy
63
+ - lib/compiler/ast/node.fy
64
+ - lib/compiler/ast/range.fy
65
+ - lib/compiler/ast/require.fy
66
+ - lib/compiler/ast/return.fy
67
+ - lib/compiler/ast/script.fy
68
+ - lib/compiler/ast/singleton_method_def.fy
69
+ - lib/compiler/ast/super.fy
70
+ - lib/compiler/ast/try_catch.fy
71
+ - lib/compiler/ast/tuple_literal.fy
72
+ - lib/compiler/ast.fy
73
+ - lib/compiler/command.fy
74
+ - lib/compiler/compiler.fy
75
+ - lib/compiler/stages.fy
76
+ - lib/compiler.fy
77
+ - lib/directory.fy
78
+ - lib/documentation.fy
79
+ - lib/enumerable.fy
80
+ - lib/eval.fy
81
+ - lib/fancy_spec.fy
82
+ - lib/fdoc.fy
83
+ - lib/fdoc_hook.fy
84
+ - lib/file.fy
85
+ - lib/hash.fy
86
+ - lib/main.fy
87
+ - lib/method.fy
88
+ - lib/nil_class.fy
89
+ - lib/number.fy
90
+ - lib/object.fy
91
+ - lib/package/dependency.fy
92
+ - lib/package/installer.fy
93
+ - lib/package/specification.fy
94
+ - lib/package/uninstaller.fy
95
+ - lib/package.fy
96
+ - lib/parser/methods.fy
97
+ - lib/parser.fy
98
+ - lib/rbx/array.fy
99
+ - lib/rbx/bignum.fy
100
+ - lib/rbx/block.fy
101
+ - lib/rbx/class.fy
102
+ - lib/rbx/code_loader.fy
103
+ - lib/rbx/console.fy
104
+ - lib/rbx/directory.fy
105
+ - lib/rbx/documentation.fy
106
+ - lib/rbx/environment_variables.fy
107
+ - lib/rbx/exception.fy
108
+ - lib/rbx/false_class.fy
109
+ - lib/rbx/fiber.fy
110
+ - lib/rbx/file.fy
111
+ - lib/rbx/fixnum.fy
112
+ - lib/rbx/float.fy
113
+ - lib/rbx/hash.fy
114
+ - lib/rbx/integer.fy
115
+ - lib/rbx/io.fy
116
+ - lib/rbx/match_data.fy
117
+ - lib/rbx/method.fy
118
+ - lib/rbx/name_error.fy
119
+ - lib/rbx/no_method_error.fy
120
+ - lib/rbx/object.fy
121
+ - lib/rbx/range.fy
122
+ - lib/rbx/regexp.fy
123
+ - lib/rbx/string.fy
124
+ - lib/rbx/symbol.fy
125
+ - lib/rbx/system.fy
126
+ - lib/rbx/tcp_server.fy
127
+ - lib/rbx/tcp_socket.fy
128
+ - lib/rbx/thread.fy
129
+ - lib/rbx/tuple.fy
130
+ - lib/rbx.fy
131
+ - lib/set.fy
132
+ - lib/stack.fy
133
+ - lib/string.fy
134
+ - lib/struct.fy
135
+ - lib/symbol.fy
136
+ - lib/true_class.fy
137
+ - lib/tuple.fy
138
+ - lib/version.fy
139
+ - lib/parser/ext/ext.c
140
+ - lib/parser/ext/ext.h
141
+ - lib/parser/ext/extconf.rb
142
+ - lib/parser/ext/lexer.lex
143
+ - lib/parser/ext/parser.y
144
+ - lib/parser/ext/README
145
+ - tests/argv.fy
146
+ - tests/array.fy
147
+ - tests/assignment.fy
148
+ - tests/block.fy
149
+ - tests/class.fy
150
+ - tests/control_flow.fy
151
+ - tests/documentation.fy
152
+ - tests/exception.fy
153
+ - tests/file.fy
154
+ - tests/hash.fy
155
+ - tests/method.fy
156
+ - tests/nil_class.fy
157
+ - tests/number.fy
158
+ - tests/object.fy
159
+ - tests/parsing/sexp.fy
160
+ - tests/pattern_matching.fy
161
+ - tests/range.fy
162
+ - tests/set.fy
163
+ - tests/stack.fy
164
+ - tests/string.fy
165
+ - tests/symbol.fy
166
+ - tests/true_class.fy
167
+ - tests/tuple.fy
168
+ - tools/fancy-mode.el
169
+ - bin/fancy
170
+ - bin/fdoc
171
+ - bin/fyi
172
+ - bin/ifancy
173
+ - examples/argv.fy
174
+ - examples/arithmetic.fy
175
+ - examples/armstrong_numbers.fy
176
+ - examples/array.fy
177
+ - examples/blocks.fy
178
+ - examples/boolean.fy
179
+ - examples/call_with_receiver.fy
180
+ - examples/class.fy
181
+ - examples/closures.fy
182
+ - examples/constant_access.fy
183
+ - examples/default_args.fy
184
+ - examples/define_methods.fy
185
+ - examples/documentation.fy
186
+ - examples/documentation_formatters.fy
187
+ - examples/echo.fy
188
+ - examples/empty_catch.fy
189
+ - examples/exception.fy
190
+ - examples/factorial.fy
191
+ - examples/fibonacci.fy
192
+ - examples/files.fy
193
+ - examples/finally.fy
194
+ - examples/game_of_life.fy
195
+ - examples/hashes.fy
196
+ - examples/hello_world.fy
197
+ - examples/html_generator.fy
198
+ - examples/implicit_return.fy
199
+ - examples/matchers.fy
200
+ - examples/methods.fy
201
+ - examples/nested_classes.fy
202
+ - examples/nested_try.fy
203
+ - examples/numbers.fy
204
+ - examples/pattern_matching.fy
205
+ - examples/person.fy
206
+ - examples/project-euler/01.fy
207
+ - examples/project-euler/02.fy
208
+ - examples/project-euler/28.fy
209
+ - examples/rbx/and_or.fy
210
+ - examples/rbx/blocks.fy
211
+ - examples/rbx/classes.fy
212
+ - examples/rbx/hello.fy
213
+ - examples/rbx/include.fy
214
+ - examples/rbx/inherit.fy
215
+ - examples/rbx/methods.fy
216
+ - examples/rbx/nested_classes.fy
217
+ - examples/rbx/require.fy
218
+ - examples/rbx/strings.fy
219
+ - examples/regex.fy
220
+ - examples/require.fy
221
+ - examples/retry.fy
222
+ - examples/return.fy
223
+ - examples/ruby_require.fy
224
+ - examples/ruby_send.fy
225
+ - examples/singleton_methods.fy
226
+ - examples/stupid_quicksort.fy
227
+ - examples/threads.fy
228
+ - examples/tuple.fy
229
+ - examples/webserver/webserver.fy
230
+ - doc/api/fancy.css
231
+ - doc/api/fancy.jsonp
232
+ - doc/api/fdoc.js
233
+ - doc/api/index.html
234
+ - doc/api/underscore-min.js
235
+ - doc/features.md
236
+ - boot/code_loader.rb
237
+ - boot/compile.fy
238
+ - boot/fancy_ext/block_env.rb
239
+ - boot/fancy_ext/class.rb
240
+ - boot/fancy_ext/kernel.rb
241
+ - boot/fancy_ext/module.rb
242
+ - boot/fancy_ext/object.rb
243
+ - boot/fancy_ext/string_helper.rb
244
+ - boot/fancy_ext.rb
245
+ - boot/load.rb
246
+ - boot/rbx-compiler/compiler/ast/array_literal.rb
247
+ - boot/rbx-compiler/compiler/ast/assign.rb
248
+ - boot/rbx-compiler/compiler/ast/block.rb
249
+ - boot/rbx-compiler/compiler/ast/class_def.rb
250
+ - boot/rbx-compiler/compiler/ast/expression_list.rb
251
+ - boot/rbx-compiler/compiler/ast/hash_literal.rb
252
+ - boot/rbx-compiler/compiler/ast/identifier.rb
253
+ - boot/rbx-compiler/compiler/ast/match.rb
254
+ - boot/rbx-compiler/compiler/ast/message_send.rb
255
+ - boot/rbx-compiler/compiler/ast/method_def.rb
256
+ - boot/rbx-compiler/compiler/ast/node.rb
257
+ - boot/rbx-compiler/compiler/ast/range_literal.rb
258
+ - boot/rbx-compiler/compiler/ast/README
259
+ - boot/rbx-compiler/compiler/ast/require.rb
260
+ - boot/rbx-compiler/compiler/ast/return.rb
261
+ - boot/rbx-compiler/compiler/ast/ruby_args.rb
262
+ - boot/rbx-compiler/compiler/ast/script.rb
263
+ - boot/rbx-compiler/compiler/ast/singleton_method_def.rb
264
+ - boot/rbx-compiler/compiler/ast/string_literal.rb
265
+ - boot/rbx-compiler/compiler/ast/super.rb
266
+ - boot/rbx-compiler/compiler/ast/try_catch_block.rb
267
+ - boot/rbx-compiler/compiler/ast/tuple_literal.rb
268
+ - boot/rbx-compiler/compiler/ast.rb
269
+ - boot/rbx-compiler/compiler/command.rb
270
+ - boot/rbx-compiler/compiler/compiler.rb
271
+ - boot/rbx-compiler/compiler/stages.rb
272
+ - boot/rbx-compiler/compiler.rb
273
+ - boot/rbx-compiler/parser/extconf.rb
274
+ - boot/rbx-compiler/parser/fancy_parser.bundle
275
+ - boot/rbx-compiler/parser/fancy_parser.c
276
+ - boot/rbx-compiler/parser/fancy_parser.h
277
+ - boot/rbx-compiler/parser/lexer.lex
278
+ - boot/rbx-compiler/parser/parser.rb
279
+ - boot/rbx-compiler/parser/parser.y
280
+ - boot/rbx-compiler/parser/Rakefile
281
+ - boot/rbx-compiler/parser/README
282
+ - boot/rbx-compiler/parser.rb
283
+ - boot/rbx-compiler/README
284
+ - boot/README
285
+ - boot/rsexp_pretty_printer.rb
286
+ has_rdoc: true
287
+ homepage: http://www.fancy-lang.org
288
+ licenses:
289
+ - BSD
290
+ post_install_message:
291
+ rdoc_options: []
292
+
293
+ require_paths:
294
+ - lib
295
+ required_ruby_version: !ruby/object:Gem::Requirement
296
+ none: false
297
+ requirements:
298
+ - - ">="
299
+ - !ruby/object:Gem::Version
300
+ hash: 3
301
+ segments:
302
+ - 0
303
+ version: "0"
304
+ required_rubygems_version: !ruby/object:Gem::Requirement
305
+ none: false
306
+ requirements:
307
+ - - ">="
308
+ - !ruby/object:Gem::Version
309
+ hash: 3
310
+ segments:
311
+ - 0
312
+ version: "0"
313
+ requirements: []
314
+
315
+ rubyforge_project: fancy
316
+ rubygems_version: 1.5.0
317
+ signing_key:
318
+ specification_version: 3
319
+ summary: The Fancy Programming Language
320
+ test_files: []
321
+