zomg 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +7 -0
- data/lib/zomg/idl/lexer.rb +2 -2
- data/lib/zomg/idl/visitors/ruby_sexp.rb +39 -8
- data/lib/zomg/version.rb +1 -1
- data/test/conversions/test_attribute.rb +20 -4
- metadata +2 -2
data/History.txt
CHANGED
data/lib/zomg/idl/lexer.rb
CHANGED
@@ -13,9 +13,9 @@ module ZOMG
|
|
13
13
|
|
14
14
|
class Lexer < Racc::Parser
|
15
15
|
|
16
|
-
module_eval <<'..end lib/yacc.y modeval..
|
16
|
+
module_eval <<'..end lib/yacc.y modeval..id0b7ea27db0', 'lib/yacc.y', 861
|
17
17
|
include ZOMG::IDL::Nodes
|
18
|
-
..end lib/yacc.y modeval..
|
18
|
+
..end lib/yacc.y modeval..id0b7ea27db0
|
19
19
|
|
20
20
|
##### racc 1.4.5 generates ###
|
21
21
|
|
@@ -9,18 +9,29 @@ module ZOMG
|
|
9
9
|
def visit_Module(o)
|
10
10
|
[ :module,
|
11
11
|
classify(o.name),
|
12
|
-
[:scope, [:block] +
|
12
|
+
[:scope, [:block] +
|
13
|
+
o.children.map { |c| c.accept(self) }.compact
|
14
|
+
]
|
13
15
|
]
|
14
16
|
end
|
15
17
|
|
16
18
|
def visit_Interface(o)
|
17
19
|
header = o.header.accept(self)
|
18
20
|
header = header ? [:block, header] : [:block]
|
21
|
+
o.children.each { |c|
|
22
|
+
list = c.accept(self)
|
23
|
+
if list
|
24
|
+
if list.first.is_a?(Symbol)
|
25
|
+
header << list
|
26
|
+
else
|
27
|
+
header += list
|
28
|
+
end
|
29
|
+
end
|
30
|
+
}
|
19
31
|
[ :module,
|
20
32
|
classify(o.header.name),
|
21
33
|
[:scope,
|
22
|
-
header
|
23
|
-
o.children.map { |c| c.accept(self) }
|
34
|
+
header
|
24
35
|
]
|
25
36
|
]
|
26
37
|
end
|
@@ -50,11 +61,31 @@ module ZOMG
|
|
50
61
|
end
|
51
62
|
|
52
63
|
def visit_Attribute(o)
|
53
|
-
[
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
64
|
+
attributes = []
|
65
|
+
o.children.each { |name|
|
66
|
+
name = name.accept(self)
|
67
|
+
|
68
|
+
# Reader
|
69
|
+
attributes <<
|
70
|
+
[:defn, name.to_sym,
|
71
|
+
[:scope, [:block, [:args],
|
72
|
+
[:fcall, :raise, [:array,
|
73
|
+
[:call, [:const, :NotImplementedError], :new]]
|
74
|
+
]
|
75
|
+
]]
|
76
|
+
]
|
77
|
+
unless o.readonly
|
78
|
+
attributes <<
|
79
|
+
[:defn, :"#{name}=",
|
80
|
+
[:scope, [:block, [:args, :_],
|
81
|
+
[:fcall, :raise, [:array,
|
82
|
+
[:call, [:const, :NotImplementedError], :new]]
|
83
|
+
]
|
84
|
+
]]
|
85
|
+
]
|
86
|
+
end
|
87
|
+
}
|
88
|
+
attributes
|
58
89
|
end
|
59
90
|
|
60
91
|
def visit_ScopedName(o)
|
data/lib/zomg/version.rb
CHANGED
@@ -19,10 +19,26 @@ module ZOMG
|
|
19
19
|
assert sexp
|
20
20
|
ruby_sexp =
|
21
21
|
[:block,
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
22
|
+
[:module,
|
23
|
+
:Foo,
|
24
|
+
[:scope,
|
25
|
+
[:block,
|
26
|
+
[:defn,
|
27
|
+
:awesome,
|
28
|
+
[:scope,
|
29
|
+
[:block,
|
30
|
+
[:args],
|
31
|
+
[:fcall,
|
32
|
+
:raise,
|
33
|
+
[:array, [:call, [:const, :NotImplementedError], :new]]]]]],
|
34
|
+
[:defn,
|
35
|
+
:awesome=,
|
36
|
+
[:scope,
|
37
|
+
[:block,
|
38
|
+
[:args, :_],
|
39
|
+
[:fcall,
|
40
|
+
:raise,
|
41
|
+
[:array, [:call, [:const, :NotImplementedError], :new]]]]]]]]]]
|
26
42
|
assert_equal(ruby_sexp, sexp)
|
27
43
|
end
|
28
44
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zomg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Patterson
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-08-
|
12
|
+
date: 2008-08-22 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|