Permalink
Browse files

metaprogramming the struct node

  • Loading branch information...
1 parent e48ffde commit ea324ae108b6d76f03610086e2b7063162c7b1a0 @tenderlove committed Aug 13, 2008
Showing with 2 additions and 15 deletions.
  1. +1 −1 lib/yacc.y
  2. +0 −1 lib/zomg.rb
  3. +1 −0 lib/zomg/idl/nodes/node.rb
  4. +0 −13 lib/zomg/idl/nodes/struct.rb
View
@@ -611,7 +611,7 @@ object_type
/*69*/
struct_type
: T_STRUCT T_IDENTIFIER T_LEFT_CURLY_BRACKET member_list
- T_RIGHT_CURLY_BRACKET { result = Struct.new(val[1], val[3]) }
+ T_RIGHT_CURLY_BRACKET { result = Struct.new(val[3], :name => val[1]) }
;
/*70*/
View
@@ -10,7 +10,6 @@
operation
parameter
attribute
- struct
simple_declarator
member
union
@@ -39,6 +39,7 @@ def to_ruby
FloatingPointLiteral BooleanLiteral Context StringLiteral
WideStringLiteral WideCharacterLiteral UnaryMinus Object
UnaryPlus WString String Case Enum Exception ValueBoxDcl
+ Struct
}.each { |type| const_set(type.to_sym, Class.new(Node)) }
end
end
@@ -1,13 +0,0 @@
-module ZOMG
- module IDL
- module Nodes
- class Struct < Node
- attr_accessor :name
- def initialize(name, children)
- @name = name
- super(children)
- end
- end
- end
- end
-end

0 comments on commit ea324ae

Please sign in to comment.