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.
- data/AUTHORS +7 -0
- data/LICENSE +19 -0
- data/README +173 -0
- data/Rakefile +255 -0
- data/bin/fancy +40 -0
- data/bin/fdoc +23 -0
- data/bin/fyi +22 -0
- data/bin/ifancy +46 -0
- data/boot/README +12 -0
- data/boot/code_loader.rb +165 -0
- data/boot/compile.fy +3 -0
- data/boot/fancy_ext.rb +13 -0
- data/boot/fancy_ext/block_env.rb +29 -0
- data/boot/fancy_ext/class.rb +26 -0
- data/boot/fancy_ext/kernel.rb +12 -0
- data/boot/fancy_ext/module.rb +89 -0
- data/boot/fancy_ext/object.rb +34 -0
- data/boot/fancy_ext/string_helper.rb +10 -0
- data/boot/load.rb +72 -0
- data/boot/rbx-compiler/README +12 -0
- data/boot/rbx-compiler/compiler.rb +24 -0
- data/boot/rbx-compiler/compiler/ast.rb +23 -0
- data/boot/rbx-compiler/compiler/ast/README +11 -0
- data/boot/rbx-compiler/compiler/ast/array_literal.rb +13 -0
- data/boot/rbx-compiler/compiler/ast/assign.rb +57 -0
- data/boot/rbx-compiler/compiler/ast/block.rb +70 -0
- data/boot/rbx-compiler/compiler/ast/class_def.rb +35 -0
- data/boot/rbx-compiler/compiler/ast/expression_list.rb +57 -0
- data/boot/rbx-compiler/compiler/ast/hash_literal.rb +11 -0
- data/boot/rbx-compiler/compiler/ast/identifier.rb +120 -0
- data/boot/rbx-compiler/compiler/ast/match.rb +81 -0
- data/boot/rbx-compiler/compiler/ast/message_send.rb +71 -0
- data/boot/rbx-compiler/compiler/ast/method_def.rb +116 -0
- data/boot/rbx-compiler/compiler/ast/node.rb +6 -0
- data/boot/rbx-compiler/compiler/ast/range_literal.rb +22 -0
- data/boot/rbx-compiler/compiler/ast/require.rb +20 -0
- data/boot/rbx-compiler/compiler/ast/return.rb +29 -0
- data/boot/rbx-compiler/compiler/ast/ruby_args.rb +35 -0
- data/boot/rbx-compiler/compiler/ast/script.rb +56 -0
- data/boot/rbx-compiler/compiler/ast/singleton_method_def.rb +39 -0
- data/boot/rbx-compiler/compiler/ast/string_literal.rb +14 -0
- data/boot/rbx-compiler/compiler/ast/super.rb +25 -0
- data/boot/rbx-compiler/compiler/ast/try_catch_block.rb +220 -0
- data/boot/rbx-compiler/compiler/ast/tuple_literal.rb +33 -0
- data/boot/rbx-compiler/compiler/command.rb +39 -0
- data/boot/rbx-compiler/compiler/compiler.rb +83 -0
- data/boot/rbx-compiler/compiler/stages.rb +99 -0
- data/boot/rbx-compiler/parser.rb +2 -0
- data/boot/rbx-compiler/parser/README +15 -0
- data/boot/rbx-compiler/parser/Rakefile +54 -0
- data/boot/rbx-compiler/parser/extconf.rb +3 -0
- data/boot/rbx-compiler/parser/fancy_parser.bundle +0 -0
- data/boot/rbx-compiler/parser/fancy_parser.c +46 -0
- data/boot/rbx-compiler/parser/fancy_parser.h +8 -0
- data/boot/rbx-compiler/parser/lexer.lex +180 -0
- data/boot/rbx-compiler/parser/parser.rb +356 -0
- data/boot/rbx-compiler/parser/parser.y +711 -0
- data/boot/rsexp_pretty_printer.rb +76 -0
- data/doc/api/fancy.css +93 -0
- data/doc/api/fancy.jsonp +1 -0
- data/doc/api/fdoc.js +187 -0
- data/doc/api/index.html +57 -0
- data/doc/api/underscore-min.js +18 -0
- data/doc/features.md +228 -0
- data/examples/argv.fy +8 -0
- data/examples/arithmetic.fy +7 -0
- data/examples/armstrong_numbers.fy +33 -0
- data/examples/array.fy +52 -0
- data/examples/blocks.fy +15 -0
- data/examples/boolean.fy +24 -0
- data/examples/call_with_receiver.fy +9 -0
- data/examples/class.fy +68 -0
- data/examples/closures.fy +24 -0
- data/examples/constant_access.fy +15 -0
- data/examples/default_args.fy +17 -0
- data/examples/define_methods.fy +15 -0
- data/examples/documentation.fy +57 -0
- data/examples/documentation_formatters.fy +25 -0
- data/examples/echo.fy +16 -0
- data/examples/empty_catch.fy +4 -0
- data/examples/exception.fy +9 -0
- data/examples/factorial.fy +12 -0
- data/examples/fibonacci.fy +16 -0
- data/examples/files.fy +23 -0
- data/examples/finally.fy +5 -0
- data/examples/game_of_life.fy +148 -0
- data/examples/hashes.fy +7 -0
- data/examples/hello_world.fy +6 -0
- data/examples/html_generator.fy +54 -0
- data/examples/implicit_return.fy +3 -0
- data/examples/matchers.fy +6 -0
- data/examples/methods.fy +29 -0
- data/examples/nested_classes.fy +27 -0
- data/examples/nested_try.fy +9 -0
- data/examples/numbers.fy +12 -0
- data/examples/pattern_matching.fy +40 -0
- data/examples/person.fy +65 -0
- data/examples/project-euler/01.fy +8 -0
- data/examples/project-euler/02.fy +21 -0
- data/examples/project-euler/28.fy +33 -0
- data/examples/rbx/and_or.fy +7 -0
- data/examples/rbx/blocks.fy +22 -0
- data/examples/rbx/classes.fy +32 -0
- data/examples/rbx/hello.fy +8 -0
- data/examples/rbx/include.fy +12 -0
- data/examples/rbx/inherit.fy +11 -0
- data/examples/rbx/methods.fy +15 -0
- data/examples/rbx/nested_classes.fy +9 -0
- data/examples/rbx/require.fy +3 -0
- data/examples/rbx/strings.fy +5 -0
- data/examples/regex.fy +7 -0
- data/examples/require.fy +7 -0
- data/examples/retry.fy +12 -0
- data/examples/return.fy +13 -0
- data/examples/ruby_require.fy +7 -0
- data/examples/ruby_send.fy +3 -0
- data/examples/singleton_methods.fy +21 -0
- data/examples/stupid_quicksort.fy +12 -0
- data/examples/threads.fy +18 -0
- data/examples/tuple.fy +8 -0
- data/examples/webserver/webserver.fy +18 -0
- data/lib/argv.fy +36 -0
- data/lib/array.fy +207 -0
- data/lib/block.fy +88 -0
- data/lib/boot.fy +41 -0
- data/lib/class.fy +106 -0
- data/lib/compiler.fy +14 -0
- data/lib/compiler/ast.fy +40 -0
- data/lib/compiler/ast/assign.fy +96 -0
- data/lib/compiler/ast/block.fy +84 -0
- data/lib/compiler/ast/class_def.fy +33 -0
- data/lib/compiler/ast/expression_list.fy +47 -0
- data/lib/compiler/ast/identifier.fy +113 -0
- data/lib/compiler/ast/literals.fy +122 -0
- data/lib/compiler/ast/match.fy +88 -0
- data/lib/compiler/ast/message_send.fy +110 -0
- data/lib/compiler/ast/method_def.fy +90 -0
- data/lib/compiler/ast/node.fy +7 -0
- data/lib/compiler/ast/range.fy +16 -0
- data/lib/compiler/ast/require.fy +15 -0
- data/lib/compiler/ast/return.fy +23 -0
- data/lib/compiler/ast/script.fy +52 -0
- data/lib/compiler/ast/singleton_method_def.fy +35 -0
- data/lib/compiler/ast/super.fy +17 -0
- data/lib/compiler/ast/try_catch.fy +176 -0
- data/lib/compiler/ast/tuple_literal.fy +34 -0
- data/lib/compiler/command.fy +51 -0
- data/lib/compiler/compiler.fy +73 -0
- data/lib/compiler/stages.fy +81 -0
- data/lib/directory.fy +17 -0
- data/lib/documentation.fy +115 -0
- data/lib/enumerable.fy +269 -0
- data/lib/eval.fy +31 -0
- data/lib/fancy_spec.fy +202 -0
- data/lib/fdoc.fy +359 -0
- data/lib/fdoc_hook.fy +10 -0
- data/lib/file.fy +54 -0
- data/lib/hash.fy +56 -0
- data/lib/main.fy +80 -0
- data/lib/method.fy +22 -0
- data/lib/nil_class.fy +56 -0
- data/lib/number.fy +87 -0
- data/lib/object.fy +170 -0
- data/lib/package.fy +61 -0
- data/lib/package/dependency.fy +24 -0
- data/lib/package/installer.fy +180 -0
- data/lib/package/specification.fy +55 -0
- data/lib/package/uninstaller.fy +15 -0
- data/lib/parser.fy +4 -0
- data/lib/parser/ext/README +15 -0
- data/lib/parser/ext/ext.c +42 -0
- data/lib/parser/ext/ext.h +8 -0
- data/lib/parser/ext/extconf.rb +3 -0
- data/lib/parser/ext/lexer.lex +187 -0
- data/lib/parser/ext/parser.y +744 -0
- data/lib/parser/methods.fy +297 -0
- data/lib/rbx.fy +37 -0
- data/lib/rbx/array.fy +237 -0
- data/lib/rbx/bignum.fy +23 -0
- data/lib/rbx/block.fy +9 -0
- data/lib/rbx/class.fy +129 -0
- data/lib/rbx/code_loader.fy +192 -0
- data/lib/rbx/console.fy +63 -0
- data/lib/rbx/directory.fy +46 -0
- data/lib/rbx/documentation.fy +64 -0
- data/lib/rbx/environment_variables.fy +3 -0
- data/lib/rbx/exception.fy +30 -0
- data/lib/rbx/false_class.fy +58 -0
- data/lib/rbx/fiber.fy +25 -0
- data/lib/rbx/file.fy +191 -0
- data/lib/rbx/fixnum.fy +25 -0
- data/lib/rbx/float.fy +14 -0
- data/lib/rbx/hash.fy +38 -0
- data/lib/rbx/integer.fy +15 -0
- data/lib/rbx/io.fy +30 -0
- data/lib/rbx/match_data.fy +9 -0
- data/lib/rbx/method.fy +22 -0
- data/lib/rbx/name_error.fy +3 -0
- data/lib/rbx/no_method_error.fy +15 -0
- data/lib/rbx/object.fy +117 -0
- data/lib/rbx/range.fy +15 -0
- data/lib/rbx/regexp.fy +9 -0
- data/lib/rbx/string.fy +63 -0
- data/lib/rbx/symbol.fy +12 -0
- data/lib/rbx/system.fy +37 -0
- data/lib/rbx/tcp_server.fy +6 -0
- data/lib/rbx/tcp_socket.fy +7 -0
- data/lib/rbx/thread.fy +75 -0
- data/lib/rbx/tuple.fy +37 -0
- data/lib/set.fy +61 -0
- data/lib/stack.fy +51 -0
- data/lib/string.fy +58 -0
- data/lib/struct.fy +13 -0
- data/lib/symbol.fy +23 -0
- data/lib/true_class.fy +43 -0
- data/lib/tuple.fy +68 -0
- data/lib/version.fy +6 -0
- data/tests/argv.fy +13 -0
- data/tests/array.fy +343 -0
- data/tests/assignment.fy +53 -0
- data/tests/block.fy +103 -0
- data/tests/class.fy +409 -0
- data/tests/control_flow.fy +79 -0
- data/tests/documentation.fy +24 -0
- data/tests/exception.fy +115 -0
- data/tests/file.fy +86 -0
- data/tests/hash.fy +101 -0
- data/tests/method.fy +131 -0
- data/tests/nil_class.fy +55 -0
- data/tests/number.fy +128 -0
- data/tests/object.fy +125 -0
- data/tests/parsing/sexp.fy +50 -0
- data/tests/pattern_matching.fy +82 -0
- data/tests/range.fy +11 -0
- data/tests/set.fy +10 -0
- data/tests/stack.fy +22 -0
- data/tests/string.fy +102 -0
- data/tests/symbol.fy +17 -0
- data/tests/true_class.fy +63 -0
- data/tests/tuple.fy +21 -0
- data/tools/fancy-mode.el +63 -0
- metadata +321 -0
data/tests/set.fy
ADDED
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
|
+
}
|
data/tests/true_class.fy
ADDED
@@ -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
|
+
}
|
data/tools/fancy-mode.el
ADDED
@@ -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
|
+
|