xdrgen 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +18 -0
  3. data/.travis.yml +5 -0
  4. data/Gemfile +4 -0
  5. data/Guardfile +12 -0
  6. data/LICENSE.txt +202 -0
  7. data/README.md +79 -0
  8. data/Rakefile +6 -0
  9. data/bin/xdrgen +5 -0
  10. data/lib/xdrgen.rb +24 -0
  11. data/lib/xdrgen/ast.rb +81 -0
  12. data/lib/xdrgen/ast/concerns/contained.rb +32 -0
  13. data/lib/xdrgen/ast/concerns/has_children.rb +9 -0
  14. data/lib/xdrgen/ast/concerns/has_definitions.rb +90 -0
  15. data/lib/xdrgen/ast/concerns/named.rb +16 -0
  16. data/lib/xdrgen/ast/concerns/namespace.rb +7 -0
  17. data/lib/xdrgen/ast/concerns/nested_definition.rb +16 -0
  18. data/lib/xdrgen/ast/constant.rb +7 -0
  19. data/lib/xdrgen/ast/decimal_constant.rb +7 -0
  20. data/lib/xdrgen/ast/declarations/array.rb +15 -0
  21. data/lib/xdrgen/ast/declarations/base.rb +28 -0
  22. data/lib/xdrgen/ast/declarations/opaque.rb +11 -0
  23. data/lib/xdrgen/ast/declarations/optional.rb +5 -0
  24. data/lib/xdrgen/ast/declarations/simple.rb +7 -0
  25. data/lib/xdrgen/ast/declarations/string.rb +7 -0
  26. data/lib/xdrgen/ast/declarations/void.rb +7 -0
  27. data/lib/xdrgen/ast/definitions/base.rb +9 -0
  28. data/lib/xdrgen/ast/definitions/const.rb +12 -0
  29. data/lib/xdrgen/ast/definitions/enum.rb +17 -0
  30. data/lib/xdrgen/ast/definitions/enum_member.rb +44 -0
  31. data/lib/xdrgen/ast/definitions/namespace.rb +9 -0
  32. data/lib/xdrgen/ast/definitions/nested_enum.rb +7 -0
  33. data/lib/xdrgen/ast/definitions/nested_struct.rb +7 -0
  34. data/lib/xdrgen/ast/definitions/nested_union.rb +7 -0
  35. data/lib/xdrgen/ast/definitions/struct.rb +18 -0
  36. data/lib/xdrgen/ast/definitions/struct_body.rb +11 -0
  37. data/lib/xdrgen/ast/definitions/struct_member.rb +12 -0
  38. data/lib/xdrgen/ast/definitions/typedef.rb +19 -0
  39. data/lib/xdrgen/ast/definitions/union.rb +55 -0
  40. data/lib/xdrgen/ast/definitions/union_arm.rb +33 -0
  41. data/lib/xdrgen/ast/definitions/union_arm_case.rb +11 -0
  42. data/lib/xdrgen/ast/definitions/union_body.rb +22 -0
  43. data/lib/xdrgen/ast/definitions/union_default_arm.rb +19 -0
  44. data/lib/xdrgen/ast/fixed_size.rb +23 -0
  45. data/lib/xdrgen/ast/hexadecimal_constant.rb +7 -0
  46. data/lib/xdrgen/ast/identifier.rb +5 -0
  47. data/lib/xdrgen/ast/octal_constant.rb +7 -0
  48. data/lib/xdrgen/ast/top.rb +5 -0
  49. data/lib/xdrgen/ast/typespecs/base.rb +27 -0
  50. data/lib/xdrgen/ast/typespecs/bool.rb +5 -0
  51. data/lib/xdrgen/ast/typespecs/double.rb +5 -0
  52. data/lib/xdrgen/ast/typespecs/float.rb +5 -0
  53. data/lib/xdrgen/ast/typespecs/hyper.rb +6 -0
  54. data/lib/xdrgen/ast/typespecs/int.rb +6 -0
  55. data/lib/xdrgen/ast/typespecs/opaque.rb +10 -0
  56. data/lib/xdrgen/ast/typespecs/quadruple.rb +5 -0
  57. data/lib/xdrgen/ast/typespecs/simple.rb +14 -0
  58. data/lib/xdrgen/ast/typespecs/string.rb +9 -0
  59. data/lib/xdrgen/ast/typespecs/unsigned_hyper.rb +5 -0
  60. data/lib/xdrgen/ast/typespecs/unsigned_int.rb +5 -0
  61. data/lib/xdrgen/ast/var_size.rb +26 -0
  62. data/lib/xdrgen/ast/whitespace.rb +5 -0
  63. data/lib/xdrgen/cli.rb +31 -0
  64. data/lib/xdrgen/compilation.rb +31 -0
  65. data/lib/xdrgen/generators.rb +16 -0
  66. data/lib/xdrgen/generators/base.rb +11 -0
  67. data/lib/xdrgen/generators/elixir.rb +260 -0
  68. data/lib/xdrgen/generators/go.rb +578 -0
  69. data/lib/xdrgen/generators/java.rb +810 -0
  70. data/lib/xdrgen/generators/java/XdrDataInputStream.erb +122 -0
  71. data/lib/xdrgen/generators/java/XdrDataOutputStream.erb +96 -0
  72. data/lib/xdrgen/generators/java/XdrElement.erb +10 -0
  73. data/lib/xdrgen/generators/java/XdrString.erb +58 -0
  74. data/lib/xdrgen/generators/javascript.rb +248 -0
  75. data/lib/xdrgen/generators/ruby.rb +283 -0
  76. data/lib/xdrgen/grammar/base.treetop +71 -0
  77. data/lib/xdrgen/grammar/comments.treetop +15 -0
  78. data/lib/xdrgen/grammar/const.treetop +8 -0
  79. data/lib/xdrgen/grammar/declaration.treetop +99 -0
  80. data/lib/xdrgen/grammar/enum.treetop +46 -0
  81. data/lib/xdrgen/grammar/main.treetop +30 -0
  82. data/lib/xdrgen/grammar/namespace.treetop +12 -0
  83. data/lib/xdrgen/grammar/struct.treetop +32 -0
  84. data/lib/xdrgen/grammar/typedef.treetop +12 -0
  85. data/lib/xdrgen/grammar/union.treetop +63 -0
  86. data/lib/xdrgen/output.rb +37 -0
  87. data/lib/xdrgen/output_file.rb +87 -0
  88. data/lib/xdrgen/parser.rb +40 -0
  89. data/lib/xdrgen/version.rb +3 -0
  90. data/spec/fixtures/generator/block_comments.x +14 -0
  91. data/spec/fixtures/generator/const.x +4 -0
  92. data/spec/fixtures/generator/enum.x +36 -0
  93. data/spec/fixtures/generator/nesting.x +24 -0
  94. data/spec/fixtures/generator/optional.x +8 -0
  95. data/spec/fixtures/generator/struct.x +10 -0
  96. data/spec/fixtures/generator/test.x +77 -0
  97. data/spec/fixtures/generator/union.x +28 -0
  98. data/spec/fixtures/parser/block_comments.x +14 -0
  99. data/spec/fixtures/parser/const.x +1 -0
  100. data/spec/fixtures/parser/enum.x +35 -0
  101. data/spec/fixtures/parser/nesting.x +26 -0
  102. data/spec/fixtures/parser/optional.x +8 -0
  103. data/spec/fixtures/parser/struct.x +8 -0
  104. data/spec/fixtures/parser/test.x +77 -0
  105. data/spec/fixtures/parser/union.x +10 -0
  106. data/spec/lib/xdrgen/generator_spec.rb +30 -0
  107. data/spec/lib/xdrgen/output_file_spec.rb +33 -0
  108. data/spec/lib/xdrgen/parser_spec.rb +27 -0
  109. data/spec/spec_helper.rb +13 -0
  110. data/spec/support/fixtures.rb +27 -0
  111. data/xdrgen.gemspec +32 -0
  112. metadata +301 -0
@@ -0,0 +1,32 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'xdrgen/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "xdrgen"
8
+ spec.version = Xdrgen::VERSION
9
+ spec.authors = ["Scott Fleckenstein"]
10
+ spec.email = ["scott@stellar.org"]
11
+ spec.summary = %q{An XDR code generator}
12
+ spec.homepage = "http://github.com/stellar/xdrgen"
13
+ spec.license = "ISC"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.required_ruby_version = '>= 2.1.0'
21
+
22
+ spec.add_dependency "treetop", "~> 1.5.3"
23
+ spec.add_dependency "activesupport", "~> 5"
24
+ spec.add_dependency "slop", "~> 3.4"
25
+ spec.add_dependency "memoist", "~> 0.11.0"
26
+
27
+ spec.add_development_dependency "bundler", "~> 1.7"
28
+ spec.add_development_dependency "rake", "~> 10.0"
29
+ spec.add_development_dependency "rspec", "~> 3.1"
30
+ spec.add_development_dependency "guard-rspec"
31
+ spec.add_development_dependency "pry"
32
+ end
metadata ADDED
@@ -0,0 +1,301 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: xdrgen
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Scott Fleckenstein
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-01-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: treetop
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 1.5.3
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 1.5.3
27
+ - !ruby/object:Gem::Dependency
28
+ name: activesupport
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '5'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '5'
41
+ - !ruby/object:Gem::Dependency
42
+ name: slop
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.4'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.4'
55
+ - !ruby/object:Gem::Dependency
56
+ name: memoist
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.11.0
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.11.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: bundler
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.7'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.7'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '10.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '10.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '3.1'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '3.1'
111
+ - !ruby/object:Gem::Dependency
112
+ name: guard-rspec
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: pry
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ description:
140
+ email:
141
+ - scott@stellar.org
142
+ executables:
143
+ - xdrgen
144
+ extensions: []
145
+ extra_rdoc_files: []
146
+ files:
147
+ - ".gitignore"
148
+ - ".travis.yml"
149
+ - Gemfile
150
+ - Guardfile
151
+ - LICENSE.txt
152
+ - README.md
153
+ - Rakefile
154
+ - bin/xdrgen
155
+ - lib/xdrgen.rb
156
+ - lib/xdrgen/ast.rb
157
+ - lib/xdrgen/ast/concerns/contained.rb
158
+ - lib/xdrgen/ast/concerns/has_children.rb
159
+ - lib/xdrgen/ast/concerns/has_definitions.rb
160
+ - lib/xdrgen/ast/concerns/named.rb
161
+ - lib/xdrgen/ast/concerns/namespace.rb
162
+ - lib/xdrgen/ast/concerns/nested_definition.rb
163
+ - lib/xdrgen/ast/constant.rb
164
+ - lib/xdrgen/ast/decimal_constant.rb
165
+ - lib/xdrgen/ast/declarations/array.rb
166
+ - lib/xdrgen/ast/declarations/base.rb
167
+ - lib/xdrgen/ast/declarations/opaque.rb
168
+ - lib/xdrgen/ast/declarations/optional.rb
169
+ - lib/xdrgen/ast/declarations/simple.rb
170
+ - lib/xdrgen/ast/declarations/string.rb
171
+ - lib/xdrgen/ast/declarations/void.rb
172
+ - lib/xdrgen/ast/definitions/base.rb
173
+ - lib/xdrgen/ast/definitions/const.rb
174
+ - lib/xdrgen/ast/definitions/enum.rb
175
+ - lib/xdrgen/ast/definitions/enum_member.rb
176
+ - lib/xdrgen/ast/definitions/namespace.rb
177
+ - lib/xdrgen/ast/definitions/nested_enum.rb
178
+ - lib/xdrgen/ast/definitions/nested_struct.rb
179
+ - lib/xdrgen/ast/definitions/nested_union.rb
180
+ - lib/xdrgen/ast/definitions/struct.rb
181
+ - lib/xdrgen/ast/definitions/struct_body.rb
182
+ - lib/xdrgen/ast/definitions/struct_member.rb
183
+ - lib/xdrgen/ast/definitions/typedef.rb
184
+ - lib/xdrgen/ast/definitions/union.rb
185
+ - lib/xdrgen/ast/definitions/union_arm.rb
186
+ - lib/xdrgen/ast/definitions/union_arm_case.rb
187
+ - lib/xdrgen/ast/definitions/union_body.rb
188
+ - lib/xdrgen/ast/definitions/union_default_arm.rb
189
+ - lib/xdrgen/ast/fixed_size.rb
190
+ - lib/xdrgen/ast/hexadecimal_constant.rb
191
+ - lib/xdrgen/ast/identifier.rb
192
+ - lib/xdrgen/ast/octal_constant.rb
193
+ - lib/xdrgen/ast/top.rb
194
+ - lib/xdrgen/ast/typespecs/base.rb
195
+ - lib/xdrgen/ast/typespecs/bool.rb
196
+ - lib/xdrgen/ast/typespecs/double.rb
197
+ - lib/xdrgen/ast/typespecs/float.rb
198
+ - lib/xdrgen/ast/typespecs/hyper.rb
199
+ - lib/xdrgen/ast/typespecs/int.rb
200
+ - lib/xdrgen/ast/typespecs/opaque.rb
201
+ - lib/xdrgen/ast/typespecs/quadruple.rb
202
+ - lib/xdrgen/ast/typespecs/simple.rb
203
+ - lib/xdrgen/ast/typespecs/string.rb
204
+ - lib/xdrgen/ast/typespecs/unsigned_hyper.rb
205
+ - lib/xdrgen/ast/typespecs/unsigned_int.rb
206
+ - lib/xdrgen/ast/var_size.rb
207
+ - lib/xdrgen/ast/whitespace.rb
208
+ - lib/xdrgen/cli.rb
209
+ - lib/xdrgen/compilation.rb
210
+ - lib/xdrgen/generators.rb
211
+ - lib/xdrgen/generators/base.rb
212
+ - lib/xdrgen/generators/elixir.rb
213
+ - lib/xdrgen/generators/go.rb
214
+ - lib/xdrgen/generators/java.rb
215
+ - lib/xdrgen/generators/java/XdrDataInputStream.erb
216
+ - lib/xdrgen/generators/java/XdrDataOutputStream.erb
217
+ - lib/xdrgen/generators/java/XdrElement.erb
218
+ - lib/xdrgen/generators/java/XdrString.erb
219
+ - lib/xdrgen/generators/javascript.rb
220
+ - lib/xdrgen/generators/ruby.rb
221
+ - lib/xdrgen/grammar/base.treetop
222
+ - lib/xdrgen/grammar/comments.treetop
223
+ - lib/xdrgen/grammar/const.treetop
224
+ - lib/xdrgen/grammar/declaration.treetop
225
+ - lib/xdrgen/grammar/enum.treetop
226
+ - lib/xdrgen/grammar/main.treetop
227
+ - lib/xdrgen/grammar/namespace.treetop
228
+ - lib/xdrgen/grammar/struct.treetop
229
+ - lib/xdrgen/grammar/typedef.treetop
230
+ - lib/xdrgen/grammar/union.treetop
231
+ - lib/xdrgen/output.rb
232
+ - lib/xdrgen/output_file.rb
233
+ - lib/xdrgen/parser.rb
234
+ - lib/xdrgen/version.rb
235
+ - spec/fixtures/generator/block_comments.x
236
+ - spec/fixtures/generator/const.x
237
+ - spec/fixtures/generator/enum.x
238
+ - spec/fixtures/generator/nesting.x
239
+ - spec/fixtures/generator/optional.x
240
+ - spec/fixtures/generator/struct.x
241
+ - spec/fixtures/generator/test.x
242
+ - spec/fixtures/generator/union.x
243
+ - spec/fixtures/parser/block_comments.x
244
+ - spec/fixtures/parser/const.x
245
+ - spec/fixtures/parser/enum.x
246
+ - spec/fixtures/parser/nesting.x
247
+ - spec/fixtures/parser/optional.x
248
+ - spec/fixtures/parser/struct.x
249
+ - spec/fixtures/parser/test.x
250
+ - spec/fixtures/parser/union.x
251
+ - spec/lib/xdrgen/generator_spec.rb
252
+ - spec/lib/xdrgen/output_file_spec.rb
253
+ - spec/lib/xdrgen/parser_spec.rb
254
+ - spec/spec_helper.rb
255
+ - spec/support/fixtures.rb
256
+ - xdrgen.gemspec
257
+ homepage: http://github.com/stellar/xdrgen
258
+ licenses:
259
+ - ISC
260
+ metadata: {}
261
+ post_install_message:
262
+ rdoc_options: []
263
+ require_paths:
264
+ - lib
265
+ required_ruby_version: !ruby/object:Gem::Requirement
266
+ requirements:
267
+ - - ">="
268
+ - !ruby/object:Gem::Version
269
+ version: 2.1.0
270
+ required_rubygems_version: !ruby/object:Gem::Requirement
271
+ requirements:
272
+ - - ">="
273
+ - !ruby/object:Gem::Version
274
+ version: '0'
275
+ requirements: []
276
+ rubygems_version: 3.0.3
277
+ signing_key:
278
+ specification_version: 4
279
+ summary: An XDR code generator
280
+ test_files:
281
+ - spec/fixtures/generator/block_comments.x
282
+ - spec/fixtures/generator/const.x
283
+ - spec/fixtures/generator/enum.x
284
+ - spec/fixtures/generator/nesting.x
285
+ - spec/fixtures/generator/optional.x
286
+ - spec/fixtures/generator/struct.x
287
+ - spec/fixtures/generator/test.x
288
+ - spec/fixtures/generator/union.x
289
+ - spec/fixtures/parser/block_comments.x
290
+ - spec/fixtures/parser/const.x
291
+ - spec/fixtures/parser/enum.x
292
+ - spec/fixtures/parser/nesting.x
293
+ - spec/fixtures/parser/optional.x
294
+ - spec/fixtures/parser/struct.x
295
+ - spec/fixtures/parser/test.x
296
+ - spec/fixtures/parser/union.x
297
+ - spec/lib/xdrgen/generator_spec.rb
298
+ - spec/lib/xdrgen/output_file_spec.rb
299
+ - spec/lib/xdrgen/parser_spec.rb
300
+ - spec/spec_helper.rb
301
+ - spec/support/fixtures.rb