fancy 0.9.0 → 0.10.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/bin/fancy +1 -1
- data/bin/fspec +1 -1
- data/bin/ifancy +1 -0
- data/boot/compiler/parser/ext/fancy_parser.bundle +0 -0
- data/boot/fancy_ext/array.rb +0 -1
- data/boot/fancy_ext/object.rb +10 -0
- data/boot/rbx-compiler/parser/Makefile +207 -0
- data/boot/rbx-compiler/parser/fancy_parser.bundle +0 -0
- data/boot/rbx-compiler/parser/lexer.c +2314 -0
- data/boot/rbx-compiler/parser/lexer.h +316 -0
- data/boot/rbx-compiler/parser/parser.c +3133 -0
- data/boot/rbx-compiler/parser/parser.h +131 -0
- data/doc/api/fancy.jsonp +1 -1
- data/examples/echo.fy +1 -1
- data/examples/stupid_quicksort.fy +1 -1
- data/lib/array.fy +4 -0
- data/lib/block.fy +11 -8
- data/lib/class.fy +21 -0
- data/lib/compiler/ast.fy +1 -0
- data/lib/compiler/ast/identifier.fy +1 -3
- data/lib/compiler/ast/method_spec.fy +6 -0
- data/lib/contracts.fy +2 -2
- data/lib/documentation.fy +25 -24
- data/lib/enumerable.fy +38 -21
- data/lib/fancy_spec.fy +24 -17
- data/lib/fdoc.fy +32 -16
- data/lib/future.fy +26 -1
- data/lib/object.fy +4 -1
- data/lib/parser/ext/Makefile +207 -0
- data/lib/parser/ext/fancy_parser.bundle +0 -0
- data/lib/parser/ext/lexer.c +2442 -0
- data/lib/parser/ext/lexer.h +316 -0
- data/lib/parser/ext/lexer.lex +4 -4
- data/lib/parser/ext/parser.c +3400 -0
- data/lib/parser/ext/parser.h +135 -0
- data/lib/parser/ext/parser.y +52 -74
- data/lib/parser/methods.fy +20 -8
- data/lib/parser/parse_error.fy +2 -2
- data/lib/range.fy +1 -1
- data/lib/rbx.fy +1 -0
- data/lib/rbx/block.fy +0 -12
- data/lib/rbx/class.fy +1 -1
- data/lib/rbx/compiled_method.fy +4 -0
- data/lib/{eval.fy → rbx/eval.fy} +3 -3
- data/lib/rbx/hash.fy +13 -3
- data/lib/rbx/method.fy +1 -0
- data/lib/rbx/object.fy +5 -1
- data/lib/rbx/range.fy +1 -1
- data/lib/rbx/scopes.fy +15 -0
- data/lib/rbx/symbol.fy +4 -0
- data/lib/rbx/thread.fy +1 -1
- data/lib/set.fy +11 -0
- data/lib/string.fy +17 -17
- data/lib/symbol.fy +7 -3
- data/lib/tuple.fy +3 -8
- data/lib/version.fy +1 -1
- data/ruby_lib/fancy +1 -1
- data/ruby_lib/fancy.rb +6 -19
- data/ruby_lib/interactive/hilight.rb +5 -5
- data/tests/block.fy +36 -13
- data/tests/class.fy +124 -120
- data/tests/contracts.fy +9 -8
- data/tests/future.fy +29 -10
- data/tests/method.fy +5 -0
- data/tests/range.fy +8 -0
- data/tests/set.fy +16 -6
- data/tests/struct.fy +4 -4
- metadata +60 -55
- data/lib/queue.fy +0 -7
- data/tests/future_proxy.fy +0 -8
data/tests/contracts.fy
CHANGED
@@ -27,14 +27,15 @@ FancySpec describe: Class Contracts with: {
|
|
27
27
|
class Interface {
|
28
28
|
expects_interface_on_inclusion: ['hello, 'world]
|
29
29
|
}
|
30
|
+
|
30
31
|
{
|
31
32
|
class C {
|
32
33
|
include: Interface
|
33
34
|
}
|
34
|
-
} raises: Class Contracts InterfaceNotImplementedError with:
|
35
|
-
|
36
|
-
|
37
|
-
|
35
|
+
} raises: Class Contracts InterfaceNotImplementedError with: @{
|
36
|
+
methods is: ['hello, 'world]
|
37
|
+
interface is: Interface
|
38
|
+
including_class is: C
|
38
39
|
}
|
39
40
|
|
40
41
|
{
|
@@ -42,10 +43,10 @@ FancySpec describe: Class Contracts with: {
|
|
42
43
|
def hello
|
43
44
|
include: Interface
|
44
45
|
}
|
45
|
-
} raises: Class Contracts InterfaceNotImplementedError with:
|
46
|
-
|
47
|
-
|
48
|
-
|
46
|
+
} raises: Class Contracts InterfaceNotImplementedError with: @{
|
47
|
+
methods is: ['world]
|
48
|
+
interface is: Interface
|
49
|
+
including_class is: D
|
49
50
|
}
|
50
51
|
}
|
51
52
|
}
|
data/tests/future.fy
CHANGED
@@ -18,7 +18,7 @@ FancySpec describe: FutureSend with: {
|
|
18
18
|
|
19
19
|
it: "accesses the same future from multiple threads and blocks them until the value is computed" when: {
|
20
20
|
def another_method {
|
21
|
-
Thread sleep: 0.
|
21
|
+
Thread sleep: 0.1
|
22
22
|
42
|
23
23
|
}
|
24
24
|
|
@@ -67,14 +67,15 @@ FancySpec describe: FutureSend with: {
|
|
67
67
|
called? = false
|
68
68
|
failed? = false
|
69
69
|
val = 0
|
70
|
-
f = { Thread sleep: 0.01; "Fail!" raise! } @ call
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
70
|
+
f = { Thread sleep: 0.01; "Fail!" raise! } @ call . tap: @{
|
71
|
+
when_done: |v| {
|
72
|
+
val = v
|
73
|
+
called? = true
|
74
|
+
}
|
75
|
+
when_failed: |err| {
|
76
|
+
val = err
|
77
|
+
failed? = true
|
78
|
+
}
|
78
79
|
}
|
79
80
|
|
80
81
|
f value
|
@@ -83,4 +84,22 @@ FancySpec describe: FutureSend with: {
|
|
83
84
|
val message is: "Fail!"
|
84
85
|
val is_a?: Exception
|
85
86
|
}
|
86
|
-
}
|
87
|
+
}
|
88
|
+
|
89
|
+
FancySpec describe: FutureCollection with: {
|
90
|
+
it: "iterates over each future's value" with: 'each: when: {
|
91
|
+
futures = ("a".."z") map: |l| { l @ inspect }
|
92
|
+
FutureCollection[futures] each: |val| {
|
93
|
+
val =~ /[a-z]/ . is_not: nil
|
94
|
+
}
|
95
|
+
}
|
96
|
+
|
97
|
+
it: "awaits all futures to complete" with: 'await_all when: {
|
98
|
+
futures = (0..100) map: |i| {
|
99
|
+
{ Thread sleep: 0.01; i * 2 } @ call
|
100
|
+
}
|
101
|
+
futures all?: @{ completed? } . is: false
|
102
|
+
FutureCollection[futures] await_all
|
103
|
+
futures all?: @{ completed? } . is: true
|
104
|
+
}
|
105
|
+
}
|
data/tests/method.fy
CHANGED
data/tests/range.fy
CHANGED
@@ -8,4 +8,12 @@ FancySpec describe: Range with: {
|
|
8
8
|
it: "has a working literal syntax" when: {
|
9
9
|
(1..10) is: (Range new: 1 to: 10)
|
10
10
|
}
|
11
|
+
|
12
|
+
it: "returns a string representation" with: ['inspect, 'to_s] when: {
|
13
|
+
(1..10) inspect is: "(1..10)"
|
14
|
+
(100..1000) tap: @{
|
15
|
+
inspect is: "(100..1000)"
|
16
|
+
to_s is: "(100..1000)"
|
17
|
+
}
|
18
|
+
}
|
11
19
|
}
|
data/tests/set.fy
CHANGED
@@ -24,7 +24,7 @@ FancySpec describe: Set with: {
|
|
24
24
|
s << 'foo
|
25
25
|
s << 'foo
|
26
26
|
s size is: 1
|
27
|
-
s is:
|
27
|
+
s is: $ Set[['foo]]
|
28
28
|
s is_not: ['foo] # Sets and Arrays differ
|
29
29
|
}
|
30
30
|
|
@@ -100,9 +100,9 @@ FancySpec describe: Set with: {
|
|
100
100
|
it: "removes a value in the Set" with: 'remove: when: {
|
101
101
|
s = Set[(1,2,3)]
|
102
102
|
s remove: 2
|
103
|
-
s is:
|
103
|
+
s is: $ Set[(1,3)]
|
104
104
|
s remove: 1
|
105
|
-
s is:
|
105
|
+
s is: $ Set[[3]]
|
106
106
|
s remove: 3
|
107
107
|
s empty? . is: true
|
108
108
|
}
|
@@ -110,18 +110,28 @@ FancySpec describe: Set with: {
|
|
110
110
|
it: "returns the union of two sets" with: '+ when: {
|
111
111
|
s1 = Set[(1,2,3)]
|
112
112
|
s2 = Set[(3,4,5)]
|
113
|
-
s1 + s2 is:
|
113
|
+
s1 + s2 is: $ Set[(1,2,3,4,5)]
|
114
114
|
}
|
115
115
|
|
116
116
|
it: "returns the difference of two sets" with: '- when: {
|
117
117
|
s1 = Set[(1,2,3)]
|
118
118
|
s2 = Set[(3,4,5)]
|
119
|
-
s1 - s2 is:
|
119
|
+
s1 - s2 is: $ Set[(1,2)]
|
120
120
|
}
|
121
121
|
|
122
122
|
it: "returns the intersection of two sets" with: '& when: {
|
123
123
|
s1 = Set[(1,2,3)]
|
124
124
|
s2 = Set[(2,3,4,5)]
|
125
|
-
s1 & s2 is:
|
125
|
+
s1 & s2 is: $ Set[(2,3)]
|
126
|
+
}
|
127
|
+
|
128
|
+
it: "removes all elements from a Set" with: 'clear when: {
|
129
|
+
s = Set[(1,2,3)]
|
130
|
+
s empty? is: false
|
131
|
+
s size is: 3
|
132
|
+
s clear
|
133
|
+
s empty? is: true
|
134
|
+
s size is: 0
|
135
|
+
s is: $ Set[[]]
|
126
136
|
}
|
127
137
|
}
|
data/tests/struct.fy
CHANGED
@@ -6,13 +6,13 @@ FancySpec describe: Struct with: {
|
|
6
6
|
}
|
7
7
|
|
8
8
|
it: "creates setter methods for a struct's fields" when: {
|
9
|
-
Point instance_methods includes?:
|
10
|
-
Point instance_methods includes?:
|
9
|
+
Point instance_methods includes?: 'x: . is: true
|
10
|
+
Point instance_methods includes?: 'y: . is: true
|
11
11
|
}
|
12
12
|
|
13
13
|
it: "creates getter methods for a struct's fields" when: {
|
14
|
-
Point instance_methods includes?:
|
15
|
-
Point instance_methods includes?:
|
14
|
+
Point instance_methods includes?: ':x . is: true
|
15
|
+
Point instance_methods includes?: ':y . is: true
|
16
16
|
}
|
17
17
|
|
18
18
|
it: "works with getter and setter methods as expected" when: {
|
metadata
CHANGED
@@ -1,60 +1,63 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: fancy
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.10.0
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 9
|
9
|
-
- 0
|
10
|
-
version: 0.9.0
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Christopher Bertels
|
14
9
|
autorequire:
|
15
10
|
bindir: ruby_lib
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2013-07-30 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: rubinius-actor
|
22
16
|
prerelease: false
|
23
|
-
requirement:
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
24
22
|
none: false
|
25
|
-
requirements:
|
26
|
-
- - ">="
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
hash: 2002549777813010636
|
29
|
-
segments:
|
30
|
-
- 0
|
31
|
-
version: "0"
|
32
23
|
type: :runtime
|
33
|
-
version_requirements:
|
34
|
-
|
35
|
-
|
36
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - ! '>='
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '0'
|
29
|
+
none: false
|
30
|
+
description: ! 'The Fancy Programming Language
|
31
|
+
|
32
|
+
|
37
33
|
Fancy is a fully self-hosted, dynamic, pure class-based
|
34
|
+
|
38
35
|
object-oriented programming language heavily inspired by Smalltalk,
|
36
|
+
|
39
37
|
Ruby and Erlang. It supports dynamic code evaluation (as in Ruby &
|
38
|
+
|
40
39
|
Smalltalk), class-based mixins, generic pattern matching, runtime
|
40
|
+
|
41
41
|
introspection & reflection, "monkey patching" and much more. It runs
|
42
|
+
|
42
43
|
on Rubinius, the Ruby VM, and thus has first-class integration with
|
43
|
-
|
44
|
+
|
45
|
+
Ruby''s core library and any additional Ruby libraries that run on
|
46
|
+
|
44
47
|
Rubinius, including most C-extensions.
|
45
48
|
|
49
|
+
'
|
46
50
|
email: chris@fancy-lang.org
|
47
|
-
executables:
|
51
|
+
executables:
|
48
52
|
- fancy
|
49
53
|
- ifancy
|
50
54
|
- fdoc
|
51
55
|
- fyi
|
52
56
|
- fspec
|
53
|
-
extensions:
|
57
|
+
extensions:
|
54
58
|
- boot/extconf.rb
|
55
59
|
extra_rdoc_files: []
|
56
|
-
|
57
|
-
files:
|
60
|
+
files:
|
58
61
|
- README.md
|
59
62
|
- LICENSE
|
60
63
|
- AUTHORS
|
@@ -78,7 +81,6 @@ files:
|
|
78
81
|
- lib/dynamic_slot_object.fy
|
79
82
|
- lib/enumerable.fy
|
80
83
|
- lib/enumerator.fy
|
81
|
-
- lib/eval.fy
|
82
84
|
- lib/exception.fy
|
83
85
|
- lib/false_class.fy
|
84
86
|
- lib/fancy_spec.fy
|
@@ -102,7 +104,6 @@ files:
|
|
102
104
|
- lib/package.fy
|
103
105
|
- lib/parser.fy
|
104
106
|
- lib/proxies.fy
|
105
|
-
- lib/queue.fy
|
106
107
|
- lib/range.fy
|
107
108
|
- lib/rbx.fy
|
108
109
|
- lib/set.fy
|
@@ -145,6 +146,7 @@ files:
|
|
145
146
|
- lib/rbx/directory.fy
|
146
147
|
- lib/rbx/documentation.fy
|
147
148
|
- lib/rbx/environment_variables.fy
|
149
|
+
- lib/rbx/eval.fy
|
148
150
|
- lib/rbx/exception.fy
|
149
151
|
- lib/rbx/fiber.fy
|
150
152
|
- lib/rbx/file.fy
|
@@ -163,6 +165,7 @@ files:
|
|
163
165
|
- lib/rbx/proc.fy
|
164
166
|
- lib/rbx/range.fy
|
165
167
|
- lib/rbx/regexp.fy
|
168
|
+
- lib/rbx/scopes.fy
|
166
169
|
- lib/rbx/string.fy
|
167
170
|
- lib/rbx/stringio.fy
|
168
171
|
- lib/rbx/symbol.fy
|
@@ -183,6 +186,7 @@ files:
|
|
183
186
|
- lib/compiler/ast/match.fy
|
184
187
|
- lib/compiler/ast/message_send.fy
|
185
188
|
- lib/compiler/ast/method_def.fy
|
189
|
+
- lib/compiler/ast/method_spec.fy
|
186
190
|
- lib/compiler/ast/node.fy
|
187
191
|
- lib/compiler/ast/range.fy
|
188
192
|
- lib/compiler/ast/return.fy
|
@@ -195,7 +199,13 @@ files:
|
|
195
199
|
- lib/parser/ext/ext.c
|
196
200
|
- lib/parser/ext/ext.h
|
197
201
|
- lib/parser/ext/extconf.rb
|
202
|
+
- lib/parser/ext/fancy_parser.bundle
|
203
|
+
- lib/parser/ext/lexer.c
|
204
|
+
- lib/parser/ext/lexer.h
|
198
205
|
- lib/parser/ext/lexer.lex
|
206
|
+
- lib/parser/ext/Makefile
|
207
|
+
- lib/parser/ext/parser.c
|
208
|
+
- lib/parser/ext/parser.h
|
199
209
|
- lib/parser/ext/parser.y
|
200
210
|
- lib/parser/ext/README
|
201
211
|
- tests/argv.fy
|
@@ -216,7 +226,6 @@ files:
|
|
216
226
|
- tests/file.fy
|
217
227
|
- tests/fixnum.fy
|
218
228
|
- tests/future.fy
|
219
|
-
- tests/future_proxy.fy
|
220
229
|
- tests/hash.fy
|
221
230
|
- tests/html.fy
|
222
231
|
- tests/integer.fy
|
@@ -327,7 +336,12 @@ files:
|
|
327
336
|
- boot/rbx-compiler/parser/fancy_parser.bundle
|
328
337
|
- boot/rbx-compiler/parser/fancy_parser.c
|
329
338
|
- boot/rbx-compiler/parser/fancy_parser.h
|
339
|
+
- boot/rbx-compiler/parser/lexer.c
|
340
|
+
- boot/rbx-compiler/parser/lexer.h
|
330
341
|
- boot/rbx-compiler/parser/lexer.lex
|
342
|
+
- boot/rbx-compiler/parser/Makefile
|
343
|
+
- boot/rbx-compiler/parser/parser.c
|
344
|
+
- boot/rbx-compiler/parser/parser.h
|
331
345
|
- boot/rbx-compiler/parser/parser.rb
|
332
346
|
- boot/rbx-compiler/parser/parser.y
|
333
347
|
- boot/rbx-compiler/parser/Rakefile
|
@@ -353,39 +367,30 @@ files:
|
|
353
367
|
- boot/rbx-compiler/compiler/ast/super.rb
|
354
368
|
- boot/rbx-compiler/compiler/ast/try_catch_block.rb
|
355
369
|
- boot/rbx-compiler/compiler/ast/tuple_literal.rb
|
370
|
+
- boot/compiler/parser/ext/fancy_parser.bundle
|
356
371
|
homepage: http://www.fancy-lang.org
|
357
|
-
licenses:
|
372
|
+
licenses:
|
358
373
|
- BSD
|
359
374
|
post_install_message:
|
360
375
|
rdoc_options: []
|
361
|
-
|
362
|
-
require_paths:
|
376
|
+
require_paths:
|
363
377
|
- ruby_lib
|
364
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
378
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
379
|
+
requirements:
|
380
|
+
- - ! '>='
|
381
|
+
- !ruby/object:Gem::Version
|
382
|
+
version: 1.9.3
|
365
383
|
none: false
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
- 0
|
372
|
-
version: "0"
|
373
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
384
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
385
|
+
requirements:
|
386
|
+
- - ! '>='
|
387
|
+
- !ruby/object:Gem::Version
|
388
|
+
version: '0'
|
374
389
|
none: false
|
375
|
-
requirements:
|
376
|
-
- - ">="
|
377
|
-
- !ruby/object:Gem::Version
|
378
|
-
hash: 2002549777813010636
|
379
|
-
segments:
|
380
|
-
- 0
|
381
|
-
version: "0"
|
382
390
|
requirements: []
|
383
|
-
|
384
391
|
rubyforge_project: fancy
|
385
392
|
rubygems_version: 1.8.25
|
386
393
|
signing_key:
|
387
394
|
specification_version: 3
|
388
395
|
summary: The Fancy Programming Language
|
389
396
|
test_files: []
|
390
|
-
|
391
|
-
has_rdoc: false
|
data/lib/queue.fy
DELETED