zomg 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (238) hide show
  1. data/History.txt +6 -0
  2. data/Manifest.txt +237 -0
  3. data/README.txt +59 -0
  4. data/Rakefile +34 -0
  5. data/bin/omfg +56 -0
  6. data/lib/scanner.rex +169 -0
  7. data/lib/yacc.y +861 -0
  8. data/lib/zomg.rb +22 -0
  9. data/lib/zomg/idl.rb +14 -0
  10. data/lib/zomg/idl/lexer.rb +2151 -0
  11. data/lib/zomg/idl/nodes/attribute.rb +15 -0
  12. data/lib/zomg/idl/nodes/binary.rb +19 -0
  13. data/lib/zomg/idl/nodes/constant.rb +15 -0
  14. data/lib/zomg/idl/nodes/interface.rb +13 -0
  15. data/lib/zomg/idl/nodes/interface_header.rb +14 -0
  16. data/lib/zomg/idl/nodes/member.rb +14 -0
  17. data/lib/zomg/idl/nodes/node.rb +52 -0
  18. data/lib/zomg/idl/nodes/operation.rb +17 -0
  19. data/lib/zomg/idl/nodes/parameter.rb +18 -0
  20. data/lib/zomg/idl/nodes/typedef.rb +13 -0
  21. data/lib/zomg/idl/nodes/union.rb +14 -0
  22. data/lib/zomg/idl/parser.rb +54 -0
  23. data/lib/zomg/idl/scanner.rb +367 -0
  24. data/lib/zomg/idl/visitable.rb +15 -0
  25. data/lib/zomg/idl/visitors/duhr.rb +24 -0
  26. data/lib/zomg/idl/visitors/ruby_sexp.rb +173 -0
  27. data/lib/zomg/idl/visitors/sexp.rb +274 -0
  28. data/lib/zomg/version.rb +3 -0
  29. data/test/assets/array/array1.idl +60 -0
  30. data/test/assets/array/array2.idl +38 -0
  31. data/test/assets/array/array3.idl +8 -0
  32. data/test/assets/array/array4.idl +7 -0
  33. data/test/assets/array/array5.idl +80 -0
  34. data/test/assets/attribute/grid_0attribs_2methods.idl +16 -0
  35. data/test/assets/attribute/grid_1ROattribs_1attribs_0methods.idl +19 -0
  36. data/test/assets/attribute/grid_1ROattribs_1attribs_1methods.idl +19 -0
  37. data/test/assets/attribute/grid_1ROattribs_1attribs_2methods.idl +17 -0
  38. data/test/assets/attribute/grid_1ROattribs_1methods.idl +16 -0
  39. data/test/assets/attribute/grid_1ROattribs_2methods.idl +16 -0
  40. data/test/assets/attribute/grid_1attribs_1methods.idl +17 -0
  41. data/test/assets/attribute/grid_1attribs_2methods.idl +17 -0
  42. data/test/assets/attribute/grid_2ROattribs_0methods.idl +16 -0
  43. data/test/assets/attribute/grid_2ROattribs_1methods.idl +16 -0
  44. data/test/assets/attribute/grid_2ROattribs_2methods.idl +16 -0
  45. data/test/assets/attribute/grid_2attribs_0methods.idl +19 -0
  46. data/test/assets/attribute/grid_2attribs_1methods.idl +19 -0
  47. data/test/assets/attribute/grid_2attribs_2methods.idl +19 -0
  48. data/test/assets/comment/c_style_comments.idl +63 -0
  49. data/test/assets/comment/comment1.idl +57 -0
  50. data/test/assets/comment/cpp_style_comments.idl +168 -0
  51. data/test/assets/comment/shortform.idl +0 -0
  52. data/test/assets/complex/TestCodeSets.idl +10 -0
  53. data/test/assets/complex/TestIntfContext.idl +13 -0
  54. data/test/assets/complex/TestIntfLongLong.idl +51 -0
  55. data/test/assets/complex/TestIntfWChar.idl +52 -0
  56. data/test/assets/complex/any1.idl +22 -0
  57. data/test/assets/complex/complex1.idl +495 -0
  58. data/test/assets/complex/complex2.idl +730 -0
  59. data/test/assets/complex/complex3.idl +181 -0
  60. data/test/assets/complex/complex4.idl +181 -0
  61. data/test/assets/complex/interop_wchar.idl +60 -0
  62. data/test/assets/constant/constant1.idl +37 -0
  63. data/test/assets/constant/constant2.idl +29 -0
  64. data/test/assets/constant/constant3.idl +50 -0
  65. data/test/assets/constant/constant4.idl +21 -0
  66. data/test/assets/constant/constant5.idl +65 -0
  67. data/test/assets/constant/constant6.idl +144 -0
  68. data/test/assets/constant/constant7.idl +30 -0
  69. data/test/assets/enum/enum1.idl +13 -0
  70. data/test/assets/exception/TestIntfExceptions.idl +69 -0
  71. data/test/assets/exception/TestIntfExceptionsExt_2_0.idl +34 -0
  72. data/test/assets/exception/TestIntfExceptionsExt_2_3.idl +24 -0
  73. data/test/assets/exception/ex1.idl +6 -0
  74. data/test/assets/exception/ex2.idl +18 -0
  75. data/test/assets/exception/ex3.idl +10 -0
  76. data/test/assets/exception/ex4.idl +20 -0
  77. data/test/assets/exception/sc.idl +0 -0
  78. data/test/assets/exception/simple1.idl +18 -0
  79. data/test/assets/exception/simple2.idl +25 -0
  80. data/test/assets/factory/factory1.idl +77 -0
  81. data/test/assets/factory/objref.idl +25 -0
  82. data/test/assets/forward/forward.idl +15 -0
  83. data/test/assets/forward/forward1.idl +13 -0
  84. data/test/assets/forward/fwd_incl1.idl +6 -0
  85. data/test/assets/forward/fwd_incl2.idl +7 -0
  86. data/test/assets/include/a.idl +23 -0
  87. data/test/assets/include/b.idl +16 -0
  88. data/test/assets/include/employee.idl +12 -0
  89. data/test/assets/include/include1.idl +10 -0
  90. data/test/assets/include/include2.idl +5 -0
  91. data/test/assets/include/manager.idl +10 -0
  92. data/test/assets/include/pragma.idl +41 -0
  93. data/test/assets/include/rookie.idl +13 -0
  94. data/test/assets/include/rookiemanager.idl +15 -0
  95. data/test/assets/include/sample.idl +58 -0
  96. data/test/assets/include/sample_incl.idl +406 -0
  97. data/test/assets/inherit/IDL1.idl +18 -0
  98. data/test/assets/inherit/IDL2.idl +18 -0
  99. data/test/assets/inherit/IDL3.idl +18 -0
  100. data/test/assets/inherit/IDL4.idl +17 -0
  101. data/test/assets/inherit/diamond_inheritance.idl +31 -0
  102. data/test/assets/inherit/inherit.idl +27 -0
  103. data/test/assets/limit/longidentifiers.idl +25 -0
  104. data/test/assets/limit/namelens.idl +26 -0
  105. data/test/assets/limit/tpztest.idl +21 -0
  106. data/test/assets/module/module1.idl +29 -0
  107. data/test/assets/module/module2.idl +34 -0
  108. data/test/assets/module/module3.idl +20 -0
  109. data/test/assets/module/module4.idl +15 -0
  110. data/test/assets/nested/nested1.idl +5 -0
  111. data/test/assets/nested/nested2.idl +11 -0
  112. data/test/assets/operations/Benchmark.idl +331 -0
  113. data/test/assets/operations/CCS.idl +82 -0
  114. data/test/assets/operations/TestIntf.idl +40 -0
  115. data/test/assets/operations/TestIntfBasic.idl +653 -0
  116. data/test/assets/operations/atomic.idl +40 -0
  117. data/test/assets/operations/dif2.idl +48 -0
  118. data/test/assets/operations/interface1.idl +16 -0
  119. data/test/assets/operations/parameters.idl +111 -0
  120. data/test/assets/operations/perf.idl +84 -0
  121. data/test/assets/operations/timer.idl +104 -0
  122. data/test/assets/preprocess/base_for_diamond_inheritance_with_macros.idl +17 -0
  123. data/test/assets/preprocess/basic_macro_marshalling.idl +54 -0
  124. data/test/assets/preprocess/diamond_inheritance_with_macros.idl +74 -0
  125. data/test/assets/preprocess/macro1.idl +52 -0
  126. data/test/assets/preprocess/preprocess1.idl +246 -0
  127. data/test/assets/preprocess/preprocess2.idl +3 -0
  128. data/test/assets/recursion/loop.idl +28 -0
  129. data/test/assets/recursion/recursion1.idl +47 -0
  130. data/test/assets/recursion/recursion2.idl +74 -0
  131. data/test/assets/scenarios/filestat.idl +69 -0
  132. data/test/assets/scenarios/gateway.idl +176 -0
  133. data/test/assets/scenarios/library.idl +20 -0
  134. data/test/assets/scenarios/phone.idl +24 -0
  135. data/test/assets/scenarios/ticketservice.idl +118 -0
  136. data/test/assets/scope/scope01.idl +58 -0
  137. data/test/assets/scope/scope02.idl +25 -0
  138. data/test/assets/scope/scope03.idl +22 -0
  139. data/test/assets/scope/scope04.idl +27 -0
  140. data/test/assets/scope/scope05.idl +30 -0
  141. data/test/assets/scope/scope06.idl +51 -0
  142. data/test/assets/scope/scope07.idl +20 -0
  143. data/test/assets/scope/scope08.idl +88 -0
  144. data/test/assets/scope/scope09.idl +21 -0
  145. data/test/assets/scope/scope10.idl +95 -0
  146. data/test/assets/scope/scope11.idl +62 -0
  147. data/test/assets/scope/scope12.idl +117 -0
  148. data/test/assets/scope/scope13.idl +117 -0
  149. data/test/assets/scope/scope14.idl +117 -0
  150. data/test/assets/scope/scope15.idl +117 -0
  151. data/test/assets/scope/scope16.idl +117 -0
  152. data/test/assets/scope/scope17.idl +117 -0
  153. data/test/assets/scope/scope18.idl +117 -0
  154. data/test/assets/scope/scope19.idl +117 -0
  155. data/test/assets/scope/scope20.idl +215 -0
  156. data/test/assets/scope/scope21.idl +215 -0
  157. data/test/assets/scope/scope22.idl +205 -0
  158. data/test/assets/scope/scope23.idl +261 -0
  159. data/test/assets/scope/scope24.idl +376 -0
  160. data/test/assets/scope/scope25.idl +266 -0
  161. data/test/assets/scope/scope26.idl +180 -0
  162. data/test/assets/scope/scope27.idl +184 -0
  163. data/test/assets/scope/scope28.idl +182 -0
  164. data/test/assets/scope/scope29.idl +182 -0
  165. data/test/assets/scope/scope30.idl +40 -0
  166. data/test/assets/scope/scope31.idl +33 -0
  167. data/test/assets/scope/scope32.idl +37 -0
  168. data/test/assets/scope/scope33.idl +50 -0
  169. data/test/assets/scope/scope34.idl +97 -0
  170. data/test/assets/scope/scope35.idl +72 -0
  171. data/test/assets/scope/scope36.idl +167 -0
  172. data/test/assets/scope/scope37.idl +57 -0
  173. data/test/assets/scope/scope38.idl +38 -0
  174. data/test/assets/scope/scope39.idl +38 -0
  175. data/test/assets/scope/scope40.idl +38 -0
  176. data/test/assets/scope/scope41.idl +24 -0
  177. data/test/assets/scope/scope42.idl +64 -0
  178. data/test/assets/scope/scope43.idl +66 -0
  179. data/test/assets/scope/scope44.idl +52 -0
  180. data/test/assets/sequence/sequence1.idl +24 -0
  181. data/test/assets/sequence/sequence2.idl +9 -0
  182. data/test/assets/simple/basictypes1.idl +80 -0
  183. data/test/assets/simple/basictypes2.idl +197 -0
  184. data/test/assets/simple/basictypes3.idl +23 -0
  185. data/test/assets/simple/basictypes4.idl +73 -0
  186. data/test/assets/simple/basictypes5.idl +29 -0
  187. data/test/assets/simple/basictypes6.idl +63 -0
  188. data/test/assets/simple/simple1.idl +45 -0
  189. data/test/assets/simple/simple2.idl +61 -0
  190. data/test/assets/simple/simple3.idl +36 -0
  191. data/test/assets/string/string1.idl +11 -0
  192. data/test/assets/string/string2.idl +29 -0
  193. data/test/assets/struct/struct1.idl +20 -0
  194. data/test/assets/struct/struct2.idl +21 -0
  195. data/test/assets/struct/struct3.idl +42 -0
  196. data/test/assets/struct/struct4.idl +57 -0
  197. data/test/assets/struct/struct5.idl +71 -0
  198. data/test/assets/typecode/orb.idl +0 -0
  199. data/test/assets/typecode/pseudo.idl +25 -0
  200. data/test/assets/typedef/shorthand_typedef_struct_insideIF.idl +17 -0
  201. data/test/assets/typedef/shorthand_typedef_struct_insideIF_noMO.idl +16 -0
  202. data/test/assets/typedef/shorthand_typedef_struct_insideMO.idl +17 -0
  203. data/test/assets/typedef/shorthand_typedef_struct_outsideMO.idl +17 -0
  204. data/test/assets/typedef/typedef1.idl +8 -0
  205. data/test/assets/typedef/typedef2.idl +22 -0
  206. data/test/assets/typedef/typedef_struct_insideIF.idl +18 -0
  207. data/test/assets/typedef/typedef_struct_insideMO.idl +18 -0
  208. data/test/assets/typedef/typedef_struct_outsideMO.idl +18 -0
  209. data/test/assets/union/union1.idl +31 -0
  210. data/test/assets/union/union2.idl +22 -0
  211. data/test/assets/union/union3.idl +26 -0
  212. data/test/conversions/test_attribute.rb +30 -0
  213. data/test/conversions/test_enum.rb +25 -0
  214. data/test/conversions/test_exception.rb +24 -0
  215. data/test/conversions/test_forward_declaration.rb +22 -0
  216. data/test/conversions/test_interface.rb +30 -0
  217. data/test/conversions/test_module.rb +24 -0
  218. data/test/conversions/test_struct.rb +25 -0
  219. data/test/conversions/test_typedef.rb +22 -0
  220. data/test/conversions/test_union.rb +27 -0
  221. data/test/conversions/test_value_box_dcl.rb +22 -0
  222. data/test/helper.rb +23 -0
  223. data/test/simple/test_basictypes1.rb +87 -0
  224. data/test/simple/test_basictypes2.rb +18 -0
  225. data/test/simple/test_basictypes3.rb +32 -0
  226. data/test/simple/test_basictypes4.rb +25 -0
  227. data/test/simple/test_basictypes5.rb +17 -0
  228. data/test/simple/test_basictypes6.rb +19 -0
  229. data/test/simple/test_simple1.rb +40 -0
  230. data/test/simple/test_simple2.rb +48 -0
  231. data/test/simple/test_simple3.rb +20 -0
  232. data/test/test_array.rb +22 -0
  233. data/test/test_assets.rb +33 -0
  234. data/test/test_complex.rb +17 -0
  235. data/test/test_node.rb +15 -0
  236. data/test/test_parser.rb +17 -0
  237. data/test/test_scanner.rb +234 -0
  238. metadata +336 -0
@@ -0,0 +1,861 @@
1
+ class ZOMG::IDL::Lexer
2
+
3
+ /*
4
+ * MICO --- a free CORBA implementation
5
+ * Copyright (C) 1997-98 Kay Roemer & Arno Puder
6
+ *
7
+ * This program is free software; you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation; either version 2 of the License, or
10
+ * (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU General Public License
18
+ * along with this program; if not, write to the Free Software
19
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
+ *
21
+ * Send comments and/or bug reports to:
22
+ * mico@informatik.uni-frankfurt.de
23
+ *
24
+ * Converstion to RACC Copyright (C) 2008 Aaron Patterson
25
+ */
26
+
27
+ token T_AMPERSAND
28
+ token T_ANY
29
+ token T_ASTERISK
30
+ token T_ATTRIBUTE
31
+ token T_BOOLEAN
32
+ token T_CASE
33
+ token T_CHAR
34
+ token T_CHARACTER_LITERAL
35
+ token T_WIDE_CHARACTER_LITERAL
36
+ token T_CIRCUMFLEX
37
+ token T_COLON
38
+ token T_COMMA
39
+ token T_CONST
40
+ token T_CONTEXT
41
+ token T_DEFAULT
42
+ token T_DOUBLE
43
+ token T_ENUM
44
+ token T_EQUAL
45
+ token T_EXCEPTION
46
+ token T_FALSE
47
+ token T_FIXED
48
+ token T_FIXED_PT_LITERAL
49
+ token T_FLOAT
50
+ token T_FLOATING_PT_LITERAL
51
+ token T_GREATER_THAN_SIGN
52
+ token T_IDENTIFIER
53
+ token T_IN
54
+ token T_INOUT
55
+ token T_INTEGER_LITERAL
56
+ token T_INTERFACE
57
+ token T_LEFT_CURLY_BRACKET
58
+ token T_LEFT_PARANTHESIS
59
+ token T_LEFT_SQUARE_BRACKET
60
+ token T_LESS_THAN_SIGN
61
+ token T_LONG
62
+ token T_MINUS_SIGN
63
+ token T_MODULE
64
+ token T_OCTET
65
+ token T_ONEWAY
66
+ token T_OUT
67
+ token T_PERCENT_SIGN
68
+ token T_PLUS_SIGN
69
+ token T_PRINCIPAL
70
+ token T_RAISES
71
+ token T_READONLY
72
+ token T_RIGHT_CURLY_BRACKET
73
+ token T_RIGHT_PARANTHESIS
74
+ token T_RIGHT_SQUARE_BRACKET
75
+ token T_SCOPE
76
+ token T_SEMICOLON
77
+ token T_SEQUENCE
78
+ token T_SHIFTLEFT
79
+ token T_SHIFTRIGHT
80
+ token T_SHORT
81
+ token T_SOLIDUS
82
+ token T_STRING
83
+ token T_STRING_LITERAL
84
+ token T_WIDE_STRING_LITERAL
85
+ token T_PRAGMA
86
+ token T_STRUCT
87
+ token T_SWITCH
88
+ token T_TILDE
89
+ token T_TRUE
90
+ token T_OBJECT
91
+ token T_TYPEDEF
92
+ token T_UNION
93
+ token T_UNSIGNED
94
+ token T_VERTICAL_LINE
95
+ token T_VOID
96
+ token T_WCHAR
97
+ token T_WSTRING
98
+ token T_UNKNOWN
99
+ token T_ABSTRACT
100
+ token T_VALUETYPE
101
+ token T_TRUNCATABLE
102
+ token T_SUPPORTS
103
+ token T_CUSTOM
104
+ token T_PUBLIC
105
+ token T_PRIVATE
106
+ token T_FACTORY
107
+ token T_NATIVE
108
+ token T_VALUEBASE
109
+
110
+ rule
111
+
112
+ /*1*/
113
+ specification
114
+ : /*empty*/ { result = Specification.new([]) }
115
+ | definitions { result = Specification.new(val[0]) }
116
+ ;
117
+
118
+
119
+ definitions
120
+ : definition { result = val }
121
+ | definition definitions { result = val.flatten }
122
+ ;
123
+
124
+ /*2*/
125
+ definition
126
+ : type_dcl T_SEMICOLON
127
+ | const_dcl T_SEMICOLON
128
+ | except_dcl T_SEMICOLON
129
+ | interface T_SEMICOLON
130
+ | module T_SEMICOLON
131
+ | value T_SEMICOLON
132
+ ;
133
+
134
+ /*3*/
135
+ module
136
+ : T_MODULE T_IDENTIFIER T_LEFT_CURLY_BRACKET
137
+ definitions T_RIGHT_CURLY_BRACKET {
138
+ result = Module.new(val[3], :name => val[1])
139
+ }
140
+ ;
141
+
142
+ /*4*/
143
+ interface
144
+ : interface_dcl
145
+ | forward_dcl
146
+ ;
147
+
148
+ /*5*/
149
+ interface_dcl
150
+ : interface_header T_LEFT_CURLY_BRACKET interface_body
151
+ T_RIGHT_CURLY_BRACKET {
152
+ result = Interface.new(val[0], val[2] || [])
153
+ }
154
+ ;
155
+
156
+ /*6*/
157
+ forward_dcl
158
+ : T_INTERFACE T_IDENTIFIER { result = ForwardDeclaration.new(val[1]) }
159
+ | T_ABSTRACT T_INTERFACE T_IDENTIFIER
160
+ ;
161
+
162
+ /*7*/
163
+ interface_header
164
+ : T_INTERFACE T_IDENTIFIER { result = InterfaceHeader.new(false, val[1]) }
165
+ | T_INTERFACE T_IDENTIFIER interface_inheritance_spec {
166
+ result = InterfaceHeader.new(false, val[1], val[2])
167
+ }
168
+ | T_ABSTRACT T_INTERFACE T_IDENTIFIER
169
+ | T_ABSTRACT T_INTERFACE T_IDENTIFIER interface_inheritance_spec
170
+ ;
171
+
172
+ /*8*/
173
+ interface_body
174
+ : /*empty*/
175
+ | exports
176
+ ;
177
+
178
+ exports
179
+ : export { result = val }
180
+ | export exports { result = val.flatten }
181
+ ;
182
+
183
+ /*9*/
184
+ export
185
+ : type_dcl T_SEMICOLON
186
+ | const_dcl T_SEMICOLON
187
+ | except_dcl T_SEMICOLON
188
+ | attr_dcl T_SEMICOLON
189
+ | op_dcl T_SEMICOLON
190
+ ;
191
+
192
+ /*10*/
193
+ interface_inheritance_spec
194
+ : T_COLON interface_names { result = val[1] }
195
+ ;
196
+
197
+ interface_names
198
+ : scoped_names
199
+ ;
200
+
201
+ scoped_names
202
+ : scoped_name { result = val }
203
+ | scoped_name T_COMMA scoped_names { result = [val.first, val.last].flatten }
204
+ ;
205
+
206
+ /*11*/
207
+ interface_name
208
+ : scoped_name
209
+ ;
210
+
211
+ /*12*/
212
+ scoped_name
213
+ : T_IDENTIFIER { result = ScopedName.new([], :name => val[0]) }
214
+ | T_SCOPE T_IDENTIFIER { result = ScopedName.new([], :name => val[0]) }
215
+ | scoped_name T_SCOPE T_IDENTIFIER {
216
+ ScopedName.new([val[0]].flatten, :name => val[2])
217
+ }
218
+ ;
219
+
220
+ /*13*/
221
+ value
222
+ : value_dcl
223
+ | value_abs_dcl
224
+ | value_box_dcl
225
+ | value_forward_dcl
226
+ ;
227
+
228
+ /*14*/
229
+ value_forward_dcl
230
+ : T_VALUETYPE T_IDENTIFIER
231
+ | T_ABSTRACT T_VALUETYPE T_IDENTIFIER
232
+ ;
233
+
234
+ /*15*/
235
+ value_box_dcl
236
+ : T_VALUETYPE T_IDENTIFIER type_spec {
237
+ result = ValueBoxDcl.new(val[2], :name => val[1])
238
+ }
239
+ ;
240
+
241
+ /*16*/
242
+ value_abs_dcl
243
+ : T_ABSTRACT T_VALUETYPE T_IDENTIFIER
244
+ T_LEFT_CURLY_BRACKET value_body T_RIGHT_CURLY_BRACKET
245
+ | T_ABSTRACT T_VALUETYPE T_IDENTIFIER value_inheritance_spec
246
+ T_LEFT_CURLY_BRACKET value_body T_RIGHT_CURLY_BRACKET
247
+ ;
248
+
249
+ value_body
250
+ : /*empty*/
251
+ | exports
252
+ ;
253
+
254
+ /*17*/
255
+ value_dcl
256
+ : value_header T_LEFT_CURLY_BRACKET value_elements
257
+ T_RIGHT_CURLY_BRACKET
258
+ | value_header T_LEFT_CURLY_BRACKET T_RIGHT_CURLY_BRACKET
259
+ ;
260
+
261
+ value_elements
262
+ : value_element
263
+ | value_element value_elements
264
+ ;
265
+
266
+ /*18*/
267
+ value_header
268
+ : T_VALUETYPE T_IDENTIFIER value_inheritance_spec
269
+ | T_CUSTOM T_VALUETYPE T_IDENTIFIER value_inheritance_spec
270
+ | T_VALUETYPE T_IDENTIFIER
271
+ | T_CUSTOM T_VALUETYPE T_IDENTIFIER
272
+ ;
273
+
274
+ /*19*/
275
+ value_inheritance_spec
276
+ : T_COLON value_inheritance_bases
277
+ | T_COLON value_inheritance_bases T_SUPPORTS interface_names
278
+ | T_SUPPORTS interface_names
279
+ ;
280
+
281
+ value_inheritance_bases
282
+ : value_name
283
+ | value_name T_COMMA value_names
284
+ | T_TRUNCATABLE value_name
285
+ | T_TRUNCATABLE value_name T_COMMA value_names
286
+ ;
287
+
288
+ value_names
289
+ : scoped_names
290
+ ;
291
+
292
+ /*20*/
293
+ value_name
294
+ : scoped_name
295
+ ;
296
+
297
+ /*21*/
298
+ value_element
299
+ : export
300
+ | state_member
301
+ | init_dcl
302
+ ;
303
+
304
+ /*22*/
305
+ state_member
306
+ : T_PUBLIC type_spec declarators T_SEMICOLON
307
+ | T_PRIVATE type_spec declarators T_SEMICOLON
308
+ ;
309
+
310
+ /*23*/
311
+ init_dcl
312
+ : T_FACTORY T_IDENTIFIER
313
+ T_LEFT_PARANTHESIS init_param_decls T_RIGHT_PARANTHESIS
314
+ T_SEMICOLON
315
+ ;
316
+
317
+ /*24*/
318
+ init_param_decls
319
+ : init_param_decl
320
+ | init_param_decl T_COMMA init_param_decls
321
+ ;
322
+
323
+ /*25*/
324
+ init_param_decl
325
+ : init_param_attribute param_type_spec simple_declarator
326
+ ;
327
+
328
+ /*26*/
329
+ init_param_attribute
330
+ : T_IN
331
+ ;
332
+
333
+ /*27*/
334
+ const_dcl
335
+ : T_CONST const_type T_IDENTIFIER T_EQUAL const_exp {
336
+ result = Constant.new(val[1], val[2], val[4])
337
+ }
338
+ ;
339
+
340
+ /*28*/
341
+ const_type
342
+ : integer_type
343
+ | char_type
344
+ | wide_char_type
345
+ | boolean_type
346
+ | floating_pt_type
347
+ | string_type
348
+ | wide_string_type
349
+ | fixed_pt_const_type
350
+ | scoped_name
351
+ | octet_type
352
+ ;
353
+
354
+ /*29*/
355
+ const_exp
356
+ : or_expr
357
+ ;
358
+
359
+ /*30*/
360
+ or_expr
361
+ : xor_expr
362
+ | or_expr T_VERTICAL_LINE xor_expr {
363
+ result = OrExpr.new(val.first, val.last)
364
+ }
365
+ ;
366
+
367
+ /*31*/
368
+ xor_expr
369
+ : and_expr
370
+ | xor_expr T_CIRCUMFLEX and_expr {
371
+ result = XorExpr.new(val.first, val.last)
372
+ }
373
+ ;
374
+
375
+ /*32*/
376
+ and_expr
377
+ : shift_expr
378
+ | and_expr T_AMPERSAND shift_expr {
379
+ result = AmpersandExpr.new(val.first, val.last)
380
+ }
381
+ ;
382
+
383
+ /*33*/
384
+ shift_expr
385
+ : add_expr
386
+ | shift_expr T_SHIFTRIGHT add_expr {
387
+ result = ShiftRightExpr.new(val.first, val.last)
388
+ }
389
+ | shift_expr T_SHIFTLEFT add_expr {
390
+ result = ShiftLeftExpr.new(val.first, val.last)
391
+ }
392
+ ;
393
+
394
+ /*34*/
395
+ add_expr
396
+ : mult_expr
397
+ | add_expr T_PLUS_SIGN mult_expr {
398
+ result = PlusExpr.new(val.first, val.last)
399
+ }
400
+ | add_expr T_MINUS_SIGN mult_expr {
401
+ result = MinusExpr.new(val.first, val.last)
402
+ }
403
+ ;
404
+
405
+ /*35*/
406
+ mult_expr
407
+ : unary_expr
408
+ | mult_expr T_ASTERISK unary_expr {
409
+ result = MultiplyExpr.new(val.first, val.last)
410
+ }
411
+ | mult_expr T_SOLIDUS unary_expr {
412
+ result = DivideExpr.new(val.first, val.last)
413
+ }
414
+ | mult_expr T_PERCENT_SIGN unary_expr {
415
+ result = ModulusExpr.new(val.first, val.last)
416
+ }
417
+ ;
418
+
419
+ /*36*/
420
+ /*37*/
421
+ unary_expr
422
+ : T_MINUS_SIGN primary_expr { result = UnaryMinus.new(val[1]) }
423
+ | T_PLUS_SIGN primary_expr { result = UnaryPlus.new(val[1]) }
424
+ | T_TILDE primary_expr { result = UnaryNot.new(val[1]) }
425
+ | primary_expr
426
+ ;
427
+
428
+ /*38*/
429
+ primary_expr
430
+ : scoped_name
431
+ | literal
432
+ | T_LEFT_PARANTHESIS const_exp T_RIGHT_PARANTHESIS { result = val[1] }
433
+ ;
434
+
435
+ /*39*/
436
+ /*40*/
437
+ literal
438
+ : T_INTEGER_LITERAL { result = IntegerLiteral.new(val.first) }
439
+ | T_string_literal { result = StringLiteral.new([val.first]) }
440
+ | T_WIDE_STRING_LITERAL { result = WideStringLiteral.new([val.first]) }
441
+ | T_CHARACTER_LITERAL { result = CharacterLiteral.new(val.first) }
442
+ | T_WIDE_CHARACTER_LITERAL { result = WideCharacterLiteral.new([val.first]) }
443
+ | T_FIXED_PT_LITERAL { raise }
444
+ | T_FLOATING_PT_LITERAL { result = FloatingPointLiteral.new(val.first) }
445
+ | T_TRUE /*boolean_literal*/ { result = BooleanLiteral.new(true) }
446
+ | T_FALSE /*boolean_literal*/ { result = BooleanLiteral.new(false) }
447
+ ;
448
+
449
+ /*41*/
450
+ positive_int_const
451
+ : const_exp
452
+ ;
453
+
454
+ /*42*/
455
+ /*43*/
456
+ type_dcl
457
+ : T_TYPEDEF type_spec declarators { result = Typedef.new(val[1], val[2]) }
458
+ | struct_type
459
+ | union_type
460
+ | enum_type
461
+ | T_NATIVE simple_declarator
462
+ ;
463
+
464
+ /*44*/
465
+ type_spec
466
+ : simple_type_spec
467
+ | constr_type_spec
468
+ ;
469
+
470
+ /*45*/
471
+ simple_type_spec
472
+ : base_type_spec
473
+ | template_type_spec
474
+ | scoped_name
475
+ ;
476
+
477
+ /*46*/
478
+ base_type_spec
479
+ : floating_pt_type
480
+ | integer_type
481
+ | char_type
482
+ | wide_char_type
483
+ | boolean_type
484
+ | octet_type
485
+ | any_type
486
+ | object_type
487
+ | value_base_type
488
+ | principal_type /*New*/
489
+ ;
490
+
491
+ /*47*/
492
+ template_type_spec
493
+ : sequence_type
494
+ | string_type
495
+ | wide_string_type
496
+ | fixed_pt_type
497
+ ;
498
+
499
+ /*48*/
500
+ constr_type_spec
501
+ : struct_type
502
+ | union_type
503
+ | enum_type
504
+ ;
505
+
506
+ /*49*/
507
+ declarators
508
+ : declarator { result = val }
509
+ | declarator T_COMMA declarators { result = [val.first, val.last].flatten }
510
+ ;
511
+
512
+ /*50*/
513
+ declarator
514
+ : simple_declarator
515
+ | complex_declarator
516
+ ;
517
+
518
+ /*51*/
519
+ simple_declarator
520
+ : T_IDENTIFIER { result = SimpleDeclarator.new([], :name => val[0]) }
521
+ ;
522
+
523
+ /*52*/
524
+ complex_declarator
525
+ : array_declarator
526
+ ;
527
+
528
+ /*53*/
529
+ floating_pt_type
530
+ : T_FLOAT { result = Float.new([]) }
531
+ | T_DOUBLE { result = Double.new([]) }
532
+ | T_LONG T_DOUBLE
533
+ ;
534
+
535
+ /*54*/
536
+ integer_type
537
+ : signed_int
538
+ | unsigned_int
539
+ ;
540
+
541
+ /*55*/
542
+ signed_int
543
+ : signed_long_int
544
+ | signed_short_int
545
+ | signed_longlong_int
546
+ ;
547
+
548
+ /*56*/
549
+ signed_short_int
550
+ : T_SHORT { result = Short.new([]) }
551
+ ;
552
+
553
+ /*57*/
554
+ signed_long_int
555
+ : T_LONG { result = Long.new([]) }
556
+ ;
557
+
558
+ /*58*/
559
+ signed_longlong_int
560
+ : T_LONG T_LONG { result = LongLong.new }
561
+ ;
562
+
563
+ /*59*/
564
+ unsigned_int
565
+ : unsigned_long_int
566
+ | unsigned_short_int
567
+ | unsigned_longlong_int
568
+ ;
569
+
570
+ /*60*/
571
+ unsigned_short_int
572
+ : T_UNSIGNED T_SHORT { result = UnsignedShort.new([]) }
573
+ ;
574
+
575
+ /*61*/
576
+ unsigned_long_int
577
+ : T_UNSIGNED T_LONG { result = UnsignedLong.new([]) }
578
+ ;
579
+
580
+ /*62*/
581
+ unsigned_longlong_int
582
+ : T_UNSIGNED T_LONG T_LONG { result = UnsignedLongLong.new }
583
+ ;
584
+
585
+ /*63*/
586
+ char_type
587
+ : T_CHAR { result = Char.new([]) }
588
+ ;
589
+
590
+ /*64*/
591
+ wide_char_type
592
+ : T_WCHAR { result = WChar.new }
593
+ ;
594
+
595
+ /*65*/
596
+ boolean_type
597
+ : T_BOOLEAN { result = Boolean.new([]) }
598
+ ;
599
+
600
+ /*66*/
601
+ octet_type
602
+ : T_OCTET { result = Octet.new([]) }
603
+ ;
604
+
605
+ /*67*/
606
+ any_type
607
+ : T_ANY { result = Any.new }
608
+ ;
609
+
610
+ /*68*/
611
+ object_type
612
+ : T_OBJECT { result = Object.new }
613
+ ;
614
+
615
+ /*69*/
616
+ struct_type
617
+ : T_STRUCT T_IDENTIFIER T_LEFT_CURLY_BRACKET member_list
618
+ T_RIGHT_CURLY_BRACKET { result = Struct.new(val[3], :name => val[1]) }
619
+ ;
620
+
621
+ /*70*/
622
+ member_list
623
+ : member { result = val }
624
+ | member member_list { result = val.flatten }
625
+ ;
626
+
627
+ /*71*/
628
+ member
629
+ : type_spec declarators T_SEMICOLON {
630
+ result = Member.new(val[0], val[1])
631
+ }
632
+ ;
633
+
634
+ /*72*/
635
+ union_type
636
+ : T_UNION T_IDENTIFIER T_SWITCH T_LEFT_PARANTHESIS
637
+ switch_type_spec T_RIGHT_PARANTHESIS T_LEFT_CURLY_BRACKET
638
+ switch_body T_RIGHT_CURLY_BRACKET {
639
+ result = Union.new(val[1], val[4], val[7])
640
+ }
641
+ ;
642
+
643
+ /*73*/
644
+ switch_type_spec
645
+ : integer_type
646
+ | char_type
647
+ | boolean_type
648
+ | enum_type
649
+ | scoped_name
650
+ ;
651
+
652
+ /*74*/
653
+ switch_body
654
+ : case { result = val.flatten }
655
+ | case switch_body { result = val.flatten }
656
+ ;
657
+
658
+ /*75*/
659
+ case
660
+ : case_label case { result = val }
661
+ | case_label element_spec T_SEMICOLON { result = Case.new([val[0], val[1]]) }
662
+ | case_label T_PRAGMA element_spec T_SEMICOLON /* New */
663
+ ;
664
+
665
+ /*76*/
666
+ case_label
667
+ : T_CASE const_exp T_COLON { result = CaseLabel.new(val[1]) }
668
+ | T_DEFAULT T_COLON { result = DefaultLabel.new(val[0]) }
669
+ ;
670
+
671
+ /*77*/
672
+ element_spec
673
+ : type_spec declarator { result = ElementSpec.new(val) }
674
+ ;
675
+
676
+ /*78*/
677
+ enum_type
678
+ : T_ENUM T_IDENTIFIER T_LEFT_CURLY_BRACKET enumerators
679
+ T_RIGHT_CURLY_BRACKET { result = Enum.new(val[3], :name => val[1]) }
680
+ ;
681
+
682
+ enumerators
683
+ : enumerator { result = val }
684
+ | enumerator T_COMMA enumerators { result = [val.first, val.last].flatten }
685
+ ;
686
+
687
+ /*79*/
688
+ enumerator
689
+ : T_IDENTIFIER
690
+ ;
691
+
692
+ /*80*/
693
+ sequence_type
694
+ : T_SEQUENCE T_LESS_THAN_SIGN simple_type_spec T_COMMA
695
+ positive_int_const T_GREATER_THAN_SIGN {
696
+ result = Sequence.new([val[2], val[4]])
697
+ }
698
+ | T_SEQUENCE T_LESS_THAN_SIGN simple_type_spec T_GREATER_THAN_SIGN {
699
+ result = Sequence.new([val[2]])
700
+ }
701
+ ;
702
+
703
+ /*81*/
704
+ string_type
705
+ : T_STRING T_LESS_THAN_SIGN positive_int_const T_GREATER_THAN_SIGN {
706
+ result = String.new([val[2]])
707
+ }
708
+ | T_STRING { result = String.new }
709
+ ;
710
+
711
+ /*82*/
712
+ wide_string_type
713
+ : T_WSTRING T_LESS_THAN_SIGN positive_int_const T_GREATER_THAN_SIGN
714
+ | T_WSTRING { result = WString.new }
715
+ ;
716
+
717
+ /*83*/
718
+ array_declarator
719
+ : T_IDENTIFIER fixed_array_sizes {
720
+ result = ArrayDeclarator.new(val[1], :name => val[0])
721
+ }
722
+ ;
723
+
724
+ fixed_array_sizes
725
+ : fixed_array_size { result = val }
726
+ | fixed_array_size fixed_array_sizes { result = val.flatten }
727
+ ;
728
+
729
+ /*84*/
730
+ fixed_array_size
731
+ : T_LEFT_SQUARE_BRACKET positive_int_const T_RIGHT_SQUARE_BRACKET {
732
+ result = ArraySize.new(val[1])
733
+ }
734
+ ;
735
+
736
+ /*85*/
737
+ attr_dcl
738
+ : T_ATTRIBUTE param_type_spec simple_declarators {
739
+ result = Attribute.new(val[1], val[2])
740
+ }
741
+ | T_READONLY T_ATTRIBUTE param_type_spec simple_declarators {
742
+ result = Attribute.new(val[2], val[3], true)
743
+ }
744
+ ;
745
+
746
+ simple_declarators
747
+ : simple_declarator { result = val }
748
+ | simple_declarator T_COMMA simple_declarators
749
+ ;
750
+
751
+ /*86*/
752
+ except_dcl
753
+ : T_EXCEPTION T_IDENTIFIER T_LEFT_CURLY_BRACKET members
754
+ T_RIGHT_CURLY_BRACKET { result = Exception.new(val[3], :name => val[1]) }
755
+ ;
756
+
757
+ members
758
+ : /*empty*/ { result = [] }
759
+ | member members { result = val.flatten }
760
+ ;
761
+
762
+ /*87*/
763
+ op_dcl
764
+ : op_attribute op_type_spec T_IDENTIFIER parameter_dcls
765
+ raises_expr context_expr { result = Operation.new(*val) }
766
+ ;
767
+
768
+ /*88*/
769
+ op_attribute
770
+ : /*empty*/
771
+ | T_ONEWAY
772
+ ;
773
+
774
+ /*89*/
775
+ op_type_spec
776
+ : param_type_spec
777
+ | T_VOID { result = Void.new([]) }
778
+ ;
779
+
780
+ /*90*/
781
+ parameter_dcls
782
+ : T_LEFT_PARANTHESIS param_dcls T_RIGHT_PARANTHESIS { result = val[1] }
783
+ | T_LEFT_PARANTHESIS T_RIGHT_PARANTHESIS { result = [] }
784
+ ;
785
+
786
+ param_dcls
787
+ : param_dcl { result = val }
788
+ | param_dcl T_COMMA param_dcls { result = [val.first, val.last].flatten }
789
+ ;
790
+
791
+ /*91*/
792
+ param_dcl
793
+ : param_attribute param_type_spec simple_declarator { result = Parameter.new(*val) }
794
+ ;
795
+
796
+ /*92*/
797
+ param_attribute
798
+ : T_IN { result = In.new }
799
+ | T_OUT { result = Out.new }
800
+ | T_INOUT { result = InOut.new }
801
+ ;
802
+
803
+ /*93*/
804
+ raises_expr
805
+ : /*empty*/
806
+ | T_RAISES T_LEFT_PARANTHESIS scoped_names T_RIGHT_PARANTHESIS {
807
+ result = val[2]
808
+ }
809
+ ;
810
+
811
+ /*94*/
812
+ context_expr
813
+ : /*empty*/
814
+ | T_CONTEXT T_LEFT_PARANTHESIS string_literals T_RIGHT_PARANTHESIS {
815
+ result = Context.new(val[2])
816
+ }
817
+ ;
818
+
819
+ string_literals
820
+ : T_string_literal { result = [StringLiteral.new(val.first)] }
821
+ | T_string_literal T_COMMA string_literals {
822
+ result = [StringLiteral.new(val.first), val.last].flatten
823
+ }
824
+ ;
825
+
826
+ T_string_literal
827
+ : T_STRING_LITERAL { result = val }
828
+ | T_STRING_LITERAL T_string_literal { result = val.flatten }
829
+ ;
830
+
831
+ /*95*/
832
+ param_type_spec
833
+ : base_type_spec
834
+ | string_type
835
+ | wide_string_type
836
+ | scoped_name
837
+ ;
838
+
839
+ /*96*/
840
+ fixed_pt_type
841
+ : T_FIXED T_LESS_THAN_SIGN positive_int_const T_COMMA
842
+ T_INTEGER_LITERAL T_GREATER_THAN_SIGN
843
+ ;
844
+
845
+ /*97*/
846
+ fixed_pt_const_type
847
+ : T_FIXED
848
+ ;
849
+
850
+ /*98*/
851
+ value_base_type
852
+ : T_VALUEBASE
853
+ ;
854
+
855
+ /* New production for Principal */
856
+ principal_type
857
+ : T_PRINCIPAL
858
+ ;
859
+
860
+ ---- inner
861
+ include ZOMG::IDL::Nodes