Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

metaprogramming the struct node

  • Loading branch information...
commit ea324ae108b6d76f03610086e2b7063162c7b1a0 1 parent e48ffde
Aaron Patterson authored
2  lib/yacc.y
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*/
1  lib/zomg.rb
View
@@ -10,7 +10,6 @@
operation
parameter
attribute
- struct
simple_declarator
member
union
1  lib/zomg/idl/nodes/node.rb
View
@@ -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
13 lib/zomg/idl/nodes/struct.rb
View
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.