ridl 2.5.6 → 2.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 314694ac1e00cdc3cbc8d6afdc18e1e7e3884670
4
- data.tar.gz: 9899c45caa2b63b1ac39c444e9e4a6c3adce1bfa
2
+ SHA256:
3
+ metadata.gz: d24bac3b0aa52e6c84a1ef61d0939d84b3277b139a69db8cfc1f7f95130bf6a2
4
+ data.tar.gz: 3f773ed9d639811aaba53a68e0ace506b5e6b11591875326665d102faeff5a8f
5
5
  SHA512:
6
- metadata.gz: 0d0dbd35ff3af48b46bc0fc8f3a0c34c136ce65a8a62e3a2314563af00ed73efa96938d16a7fa12526a6817b9dbb125781b7d36cdc5a166a483a79a3a2156bbf
7
- data.tar.gz: 51ac6bf5289b2e18e87bc3f0389c43a980f0d3188f2c97c0cbccc315cb0f6bdecd72cc103bd2599d219a1ee5e6b1f4fe083d9dfda10719d434db0bbb228bb0da
6
+ metadata.gz: 1aa10dbfdb821544c474bc3f41bf48c156a42bf51d909ed631c6030ebd546145f9f9e70945bf4aa54a68e74cfe4a4d27b38dfab937e1576338febc67ea18dc8c
7
+ data.tar.gz: b96af7bb90418102bfb030dbd798bd15384232ab2547887fd68d4a3e1dc4142c0d997ab15f4de93daf06f39e764d8d8d04720774e81031b537b343daf6570862
data/LICENSE CHANGED
@@ -1,49 +1,21 @@
1
- RIDL LICENSE
2
-
3
- RIDL (Licensed Product) is protected by copyright, and is distributed
4
- under the following terms.
5
-
6
- RIDL (Ruby IDL compiler) is an open source tool, developed by Remedy IT and
7
- written in Ruby. It is designed to provide a flexible parser/compiler
8
- frontend for OMG standard IDL.
9
- RIDL provides a generic parser component for OMG IDL and a flexible framework
10
- for plugging in (code) generation backends.
11
-
12
- Since RIDL is open source and free of licensing fees, you are free to use,
13
- modify, and distribute the source code, as long as you include this
14
- copyright statement.
15
-
16
- In particular, you can use RIDL to build proprietary software and are
17
- under no obligation to redistribute any of your source code that is built
18
- using RIDL. Note, however, that you may not do anything to the RIDL
19
- code, such as copyrighting it yourself or claiming authorship of the RIDL
20
- code, that will prevent RIDL from being distributed freely using an open
21
- source development model.
22
-
23
- Warranty
24
-
25
- LICENSED PRODUCT IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING
26
- THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
27
- PURPOSE, NON-INFRINGEMENT, OR ARISING FROM A COURSE OF DEALING, USAGE OR
28
- TRADE PRACTICE.
29
-
30
- Support
31
-
32
- LICENSED PRODUCT IS PROVIDED WITH NO SUPPORT AND WITHOUT ANY OBLIGATION ON
33
- THE PART OF REMEDY IT OR ANY OF ITS SUBSIDIARIES OR AFFILIATES TO ASSIST IN
34
- ITS USE, CORRECTION, MODIFICATION OR ENHANCEMENT.
35
-
36
- Remedy IT provides support to users who have agreed on the terms of a support
37
- contract.
38
-
39
- Liability
40
-
41
- REMEDY IT OR ANY OF ITS SUBSIDIARIES OR AFFILIATES SHALL HAVE NO LIABILITY
42
- WITH RESPECT TO THE INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS
43
- BY LICENSED PRODUCT OR ANY PART THEREOF.
44
-
45
- IN NO EVENT WILL REMEDY IT OR ANY OF ITS SUBSIDIARIES OR AFFILIATES BE LIABLE
46
- FOR ANY LOST REVENUE OR PROFITS OR OTHER SPECIAL, INDIRECT AND CONSEQUENTIAL
47
- DAMAGES, EVEN IF REMEDY IT HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
48
-
49
- RIDL is Copyright Remedy IT. Nijkerk, The Netherlands, 2006-2015.
1
+ MIT License
2
+
3
+ Copyright (c) 2019 Remedy IT Expertise BV
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.rdoc CHANGED
@@ -1,42 +1,48 @@
1
- = RIDL Compiler
1
+ {<img src="https://badge.fury.io/rb/ridl.svg" alt="Gem Version" />}[https://badge.fury.io/rb/ridl]
2
+ {<img src="https://github.com/RemedyIT/ridl/workflows/linux/badge.svg" alt="Linux CI" />}[https://github.com/RemedyIT/ridl/actions?query=workflow%3Alinux]
3
+ {<img src="https://www.codefactor.io/repository/github/remedyit/ridl/badge" alt="CodeFactor" />}[https://www.codefactor.io/repository/github/remedyit/ridl]
2
4
 
3
- home :: https://osportal.remedy.nl/projects/ridl
5
+ = RIDL Compiler
4
6
 
5
7
  == Description
6
-
7
- RIDL is a Ruby library implementing an OMG \IDL parser/compiler
8
- frontend with support for pluggable (and stackable) backends.
9
8
 
10
- == Synopsis
9
+ {RIDL}[https://www.remedy.nl/opensource/ridl.html] is a Ruby library implementing an Object Management Group (OMG) {IDL}[https://www.omg.org/spec/IDL] parser/compiler frontend with support for pluggable (and stackable) backends created by {Remedy IT}[https://www.remedy.nl].
11
10
 
12
- RIDL provides a framework for implementing compiler/generators for
13
- OMG standard \IDL interface definitions.
14
- The framework includes:
11
+ == Synopsis
15
12
 
16
- * a RACC based parser supplemented with a custom scanner/tokenizer
17
- * a complete AST class hierarchy for representing parsed \IDL specifications
13
+ RIDL provides a framework for implementing compiler/generators for OMG standard IDL definitions. The framework includes:
14
+ * a {RACC}[https://github.com/ruby/racc] based parser supplemented with a custom scanner/tokenizer
15
+ * a complete AST class hierarchy for representing parsed IDL specifications
18
16
  * a complete Type class hierarchy
19
- * \IDL constants expression support
20
- * a builtin \IDL preprocessor expression parser/evaluator
17
+ * IDL constants expression support
18
+ * a builtin IDL preprocessor expression parser/evaluator
21
19
  * a flexible framework for pluggable (and stackable) backends
22
- * basic support for backend code <b>re</b>generation
20
+ * basic support for backend code re-generation
21
+ * compliant with the {OMG IDL 3.5}[https://www.omg.org/spec/IDL/3.5] standard.
22
+
23
+ Remedy IT has developed multiple backends for RIDL. These include:
24
+ * {R2CORBA}[https://www.remedy.nl/opensource/r2corba.html] generating Ruby code
25
+ * {TAOX11}[https://www.taox11.org] generating C++11 code
26
+ * {AXCIOMA}[https://www.axcioma.org] generating C++11 code
23
27
 
24
- RIDL is compliant with the latest OMG \IDL standard.
28
+ When you want to know more about how Remedy IT can assist you with developing your own backend for RIDL contact {sales@remedy.nl}[mailto:sales@remedy.nl].
25
29
 
26
30
  == Bugs
27
31
 
28
- If you find a bug, please report it at the RIDL project's
29
- {issues tracker}[https://osportal.remedy.nl/projects/ridl/issues].
32
+ If you find a bug, please report it as {RIDL issue}[https://github.com/RemedyIT/ridl/issues].
30
33
 
31
- == License
34
+ == Warranty
32
35
 
33
- RIDL is Copyright (c) 2007-2015 Remedy IT Expertise BV, The Netherlands.
36
+ This software is provided "as is" and without any express or implied warranties, including, without limitation, the implied warranties of merchantibility and fitness for a particular purpose.
34
37
 
35
- It is free software, and may be redistributed under the terms specified in
36
- the LICENSE file.
38
+ == Installing RIDL
37
39
 
38
- == Warranty
40
+ RIDL is distributed as a Ruby Gem. You can download and install RIDL as a Ruby Gem from the common {Rubygems.org}[https://www.rubygems.org/gems/ridl] repository by executing the following command:
41
+
42
+ $ gem install ridl
43
+
44
+ The RIDL Gem is a Ruby-only Gem without any dependencies.
45
+
46
+ == Releasing new RIDL Ruby Gem
39
47
 
40
- This software is provided "as is" and without any express or implied
41
- warranties, including, without limitation, the implied warranties of
42
- merchantibility and fitness for a particular purpose.
48
+ A new RIDL ruby gem release can be made by incrementing the RIDL version in link:lib/ridl/version.rb and create a new release on {github}[https://github.com/RemedyIT/ridl/releases] matching the new version (for example v2.7.0). The github {Ruby Gem Release}[https://github.com/RemedyIT/ridl/actions?query=workflow%3A%22Ruby+Gem+Release%22] action will automatically create a new gem and push it to {Rubygems.org}[https://www.rubygems.org/gems/ridl].
data/lib/ridl/backend.rb CHANGED
@@ -8,7 +8,6 @@
8
8
  # included with this program.
9
9
  #
10
10
  # Copyright (c) Remedy IT Expertise BV
11
- # Chamber of commerce Rotterdam nr.276339, The Netherlands
12
11
  #--------------------------------------------------------------------
13
12
 
14
13
  module IDL
@@ -51,7 +50,7 @@ module IDL
51
50
  rescue LoadError => ex
52
51
  IDL.error "ERROR: Cannot load RIDL backend [:#{be_name}]"
53
52
  IDL.error ex.inspect
54
- IDL.error(ex.backtrace.join("\n")) if IDL.verbose_level>0
53
+ IDL.error(ex.backtrace.join("\n")) if IDL.verbose_level > 0
55
54
  exit 1
56
55
  end
57
56
  end
@@ -97,28 +96,25 @@ module IDL
97
96
  # base settings
98
97
  @base_backends.reverse.each {|be| be.setup_be(optlist, idl_options) }
99
98
  # initialize this backend
100
- _setup_be(optlist, idl_options)
99
+ _setup_be(optlist, idl_options) if self.respond_to?(:_setup_be, true)
101
100
  end
102
101
 
103
102
  def process_input(parser, params)
104
- # process input top-down
105
- _process_input(parser, params)
106
- @base_backends.each {|be| be.process_input(parser, params) }
103
+ # process input bottom-up
104
+ @base_backends.reverse.each {|be| be.process_input(parser, params) }
105
+ _process_input(parser, params) if self.respond_to?(:_process_input, true)
107
106
  end
108
107
 
109
108
  @@null_be = nil
110
109
 
111
110
  def self.null_be
112
- @@null_be ||= self.configure('null', '.', 'RIDL Null backend', 'Copyright (c) 2013 Remedy IT Expertise BV, The Netherlands', 1) do |becfg|
111
+ @@null_be ||= self.configure('null', '.', 'RIDL Null backend', "Copyright (c) 2013-#{Time.now.year} Remedy IT Expertise BV, The Netherlands", 1) do |becfg|
113
112
  becfg.on_setup do |optlist, params|
114
113
  # noop
115
114
  IDL.log(0, "Setup called for #{becfg.backend.title}")
116
115
  end
117
- becfg.on_process_input do |parser, params|
118
- # noop
119
- end
120
116
  end
121
117
  end
122
118
 
123
119
  end
124
- end
120
+ end
data/lib/ridl/delegate.rb CHANGED
@@ -8,14 +8,13 @@
8
8
  # included with this program.
9
9
  #
10
10
  # Copyright (c) Remedy IT Expertise BV
11
- # Chamber of commerce Rotterdam nr.276339, The Netherlands
12
11
  #--------------------------------------------------------------------
13
12
  require 'ridl/node'
14
13
  require 'ridl/expression'
15
14
 
16
15
  module IDL
17
16
 
18
- ORB_PIDL = 'orb.pidlc'
17
+ ORB_PIDL = 'orb.pidlc'.freeze
19
18
 
20
19
  class Delegator
21
20
 
@@ -26,7 +25,7 @@ class Delegator
26
25
  @@pragma_handlers = {}
27
26
 
28
27
  def self.add_pragma_handler(key, h = nil, &block)
29
- raise RuntimeError, 'add_pragma_handler requires a callable object or a block' unless (h && h.respond_to?(:call)) || block_given?
28
+ raise 'add_pragma_handler requires a callable object or a block' unless (h && h.respond_to?(:call)) || block_given?
30
29
  @@pragma_handlers[key] = block_given? ? block : h
31
30
  end
32
31
 
@@ -202,14 +201,10 @@ class Delegator
202
201
  when IDL::AST::Enumerator
203
202
  w.visit_enumerator(m)
204
203
  else
205
- raise RuntimeError, "Invalid IDL member type for walkthrough: #{m.class.name}"
204
+ raise "Invalid IDL member type for walkthrough: #{m.class.name}"
206
205
  end
207
206
  end
208
207
 
209
- def cur_parsed_name_scope
210
- @cur ? @cur.parsed_name_scope : ''
211
- end
212
-
213
208
  def is_included?(s)
214
209
  @includes.has_key?(s)
215
210
  end
@@ -218,7 +213,7 @@ class Delegator
218
213
  params = { :filename => s, :fullpath => fullpath }
219
214
  params[:defined] = true
220
215
  params[:preprocessed] = @preprocess
221
- @cur = @cur.define(IDL::AST::Include, "$INC:"+s, params)
216
+ @cur = @cur.define(IDL::AST::Include, "$INC:" + s, params)
222
217
  @includes[s] = @cur
223
218
  set_last
224
219
  @cur
@@ -233,7 +228,7 @@ class Delegator
233
228
  params = { :filename => s, :fullpath => @includes[s].fullpath }
234
229
  params[:defined] = false
235
230
  params[:preprocessed] = @includes[s].is_preprocessed?
236
- @cur.define(IDL::AST::Include, "$INC:"+s, params)
231
+ @cur.define(IDL::AST::Include, "$INC:" + s, params)
237
232
  end
238
233
 
239
234
  def pragma_prefix(s)
@@ -263,7 +258,7 @@ class Delegator
263
258
  end
264
259
 
265
260
  def handle_pragma(pragma_string)
266
- unless @@pragma_handlers.values.any? {|h| h.call(self, @cur, pragma_string)}
261
+ unless @@pragma_handlers.values.reduce(false) {|rc, h| h.call(self, @cur, pragma_string) || rc }
267
262
  IDL.log(1, "RIDL - unrecognized pragma encountered: #{pragma_string}.")
268
263
  end
269
264
  end
@@ -289,8 +284,8 @@ class Delegator
289
284
 
290
285
  def define_module(name)
291
286
  @cur = @cur.define(IDL::AST::Module, name)
292
- @cur.annotations.concat(@annotation_stack) unless @annotation_stack.empty?
293
- @annotation_stack.clear
287
+ @cur.annotations.concat(@annotation_stack)
288
+ @annotation_stack = IDL::AST::Annotations.new
294
289
  set_last
295
290
  @cur
296
291
  end
@@ -304,12 +299,12 @@ class Delegator
304
299
  end
305
300
 
306
301
  def define_template_module(global, names)
307
- if global || names.size>1
308
- raise RuntimeError, "no scoped identifier allowed for template module: #{(global ? '::' : '')+names.join('::')}"
302
+ if global || names.size > 1
303
+ raise "no scoped identifier allowed for template module: #{(global ? '::' : '') + names.join('::')}"
309
304
  end
310
305
  @cur = @cur.define(IDL::AST::TemplateModule, names[0])
311
- @cur.annotations.concat(@annotation_stack) unless @annotation_stack.empty?
312
- @annotation_stack.clear
306
+ @cur.annotations.concat(@annotation_stack)
307
+ @annotation_stack = IDL::AST::Annotations.new
313
308
  set_last
314
309
  @cur
315
310
  end
@@ -322,8 +317,8 @@ class Delegator
322
317
  define_template_module(*tmp)
323
318
  end
324
319
  params = { :type => type }
325
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
326
- @annotation_stack.clear
320
+ params[:annotations] = @annotation_stack
321
+ @annotation_stack = IDL::AST::Annotations.new
327
322
  set_last(@cur.define(IDL::AST::TemplateParam, name, params))
328
323
  @cur
329
324
  end
@@ -333,12 +328,12 @@ class Delegator
333
328
  @template_module_name = nil # reset
334
329
  template_type = parse_scopedname(*tmp)
335
330
  unless template_type.node.is_a?(IDL::AST::TemplateModule)
336
- raise RuntimeError, "invalid module template specification: #{template_type.node.typename} #{template_type.node.scoped_lm_name}"
331
+ raise "invalid module template specification: #{template_type.node.typename} #{template_type.node.scoped_lm_name}"
337
332
  end
338
333
  params = { :template => template_type.node, :template_params => parameters }
339
334
  mod_inst = @cur.define(IDL::AST::Module, name, params)
340
- mod_inst.annotations.concat(@annotation_stack) unless @annotation_stack.empty?
341
- @annotation_stack.clear
335
+ mod_inst.annotations.concat(@annotation_stack)
336
+ @annotation_stack = IDL::AST::Annotations.new
342
337
  set_last(mod_inst.template.instantiate(mod_inst))
343
338
  @cur
344
339
  end
@@ -347,8 +342,8 @@ class Delegator
347
342
  params = {}
348
343
  params[:tpl_type] = type
349
344
  params[:tpl_params] = tpl_params || []
350
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
351
- @annotation_stack.clear
345
+ params[:annotations] = @annotation_stack
346
+ @annotation_stack = IDL::AST::Annotations.new
352
347
  set_last(@cur.define(IDL::AST::TemplateModuleReference, name, params))
353
348
  @cur
354
349
  end
@@ -359,8 +354,7 @@ class Delegator
359
354
  params[:local] = attrib == :local
360
355
  params[:forward] = true
361
356
  params[:pseudo] = false
362
- raise RuntimeError,
363
- "annotations with forward declaration of #{name} not allowed" unless @annotation_stack.empty?
357
+ raise "annotations with forward declaration of #{name} not allowed" unless @annotation_stack.empty?
364
358
  @cur.define(IDL::AST::Interface, name, params)
365
359
  set_last
366
360
  @cur
@@ -373,8 +367,8 @@ class Delegator
373
367
  params[:pseudo] = attrib == :pseudo
374
368
  params[:forward] = false
375
369
  params[:inherits] = inherits
376
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
377
- @annotation_stack.clear
370
+ params[:annotations] = @annotation_stack
371
+ @annotation_stack = IDL::AST::Annotations.new
378
372
  set_last
379
373
  @cur = @cur.define(IDL::AST::Interface, name, params)
380
374
  end
@@ -389,8 +383,8 @@ class Delegator
389
383
  params[:component] = component
390
384
  params[:key] = key
391
385
  params[:supports] = supports || []
392
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
393
- @annotation_stack.clear
386
+ params[:annotations] = @annotation_stack
387
+ @annotation_stack = IDL::AST::Annotations.new
394
388
  set_last
395
389
  @cur = @cur.define(IDL::AST::Home, name, params)
396
390
  end
@@ -403,8 +397,7 @@ class Delegator
403
397
  def declare_component(name)
404
398
  params = {}
405
399
  params[:forward] = true
406
- raise RuntimeError,
407
- "annotations with forward declaration of #{name} not allowed" unless @annotation_stack.empty?
400
+ raise "annotations with forward declaration of #{name} not allowed" unless @annotation_stack.empty?
408
401
  set_last
409
402
  @cur.define(IDL::AST::Component, name, params)
410
403
  end
@@ -413,8 +406,8 @@ class Delegator
413
406
  params = {}
414
407
  params[:base] = base
415
408
  params[:supports] = supports || []
416
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
417
- @annotation_stack.clear
409
+ params[:annotations] = @annotation_stack
410
+ @annotation_stack = IDL::AST::Annotations.new
418
411
  set_last
419
412
  @cur = @cur.define(IDL::AST::Component, name, params)
420
413
  end
@@ -427,8 +420,8 @@ class Delegator
427
420
  def define_connector(name, base = nil)
428
421
  params = {}
429
422
  params[:base] = base
430
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
431
- @annotation_stack.clear
423
+ params[:annotations] = @annotation_stack
424
+ @annotation_stack = IDL::AST::Annotations.new
432
425
  set_last
433
426
  @cur = @cur.define(IDL::AST::Connector, name, params)
434
427
  end
@@ -440,8 +433,8 @@ class Delegator
440
433
 
441
434
  def define_porttype(name)
442
435
  params = {}
443
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
444
- @annotation_stack.clear
436
+ params[:annotations] = @annotation_stack
437
+ @annotation_stack = IDL::AST::Annotations.new
445
438
  set_last
446
439
  @cur = @cur.define(IDL::AST::Porttype, name, params)
447
440
  end
@@ -456,8 +449,8 @@ class Delegator
456
449
  params[:porttype] = porttype
457
450
  params[:type] = type
458
451
  params[:multiple] = multiple
459
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
460
- @annotation_stack.clear
452
+ params[:annotations] = @annotation_stack
453
+ @annotation_stack = IDL::AST::Annotations.new
461
454
  set_last(@cur.define(IDL::AST::Port, name, params))
462
455
  @cur
463
456
  end
@@ -466,8 +459,7 @@ class Delegator
466
459
  params = {}
467
460
  params[:abstract] = attrib == :abstract
468
461
  params[:forward] = true
469
- raise RuntimeError,
470
- "annotations with forward declaration of #{name} not allowed" unless @annotation_stack.empty?
462
+ raise "annotations with forward declaration of #{name} not allowed" unless @annotation_stack.empty?
471
463
  set_last
472
464
  @cur.define(IDL::AST::Eventtype, name, params)
473
465
  @cur
@@ -479,8 +471,8 @@ class Delegator
479
471
  params[:custom] = attrib == :custom
480
472
  params[:forward] = false
481
473
  params[:inherits] = inherits
482
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
483
- @annotation_stack.clear
474
+ params[:annotations] = @annotation_stack
475
+ @annotation_stack = IDL::AST::Annotations.new
484
476
  set_last
485
477
  @cur = @cur.define(IDL::AST::Eventtype, name, params)
486
478
  @cur
@@ -490,8 +482,7 @@ class Delegator
490
482
  params = {}
491
483
  params[:abstract] = attrib == :abstract
492
484
  params[:forward] = true
493
- raise RuntimeError,
494
- "annotations with forward declaration of #{name} not allowed" unless @annotation_stack.empty?
485
+ raise "annotations with forward declaration of #{name} not allowed" unless @annotation_stack.empty?
495
486
  set_last
496
487
  @cur.define(IDL::AST::Valuetype, name, params)
497
488
  @cur
@@ -503,8 +494,8 @@ class Delegator
503
494
  params[:custom] = attrib == :custom
504
495
  params[:forward] = false
505
496
  params[:inherits] = inherits
506
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
507
- @annotation_stack.clear
497
+ params[:annotations] = @annotation_stack
498
+ @annotation_stack = IDL::AST::Annotations.new
508
499
  set_last
509
500
  @cur = @cur.define(IDL::AST::Valuetype, name, params)
510
501
  @cur
@@ -523,16 +514,16 @@ class Delegator
523
514
  params = {}
524
515
  params[:type] = type
525
516
  params[:visibility] = (public_ ? :public : :private)
526
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
527
- @annotation_stack.clear
517
+ params[:annotations] = @annotation_stack
518
+ @annotation_stack = IDL::AST::Annotations.new
528
519
  set_last(@cur.define(IDL::AST::StateMember, name, params))
529
520
  @cur
530
521
  end
531
522
 
532
523
  def define_valuebox(name, type)
533
524
  params = { :type => type }
534
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
535
- @annotation_stack.clear
525
+ params[:annotations] = @annotation_stack
526
+ @annotation_stack = IDL::AST::Annotations.new
536
527
  set_last(@cur.define(IDL::AST::Valuebox, name, params))
537
528
  @cur
538
529
  end
@@ -541,8 +532,8 @@ class Delegator
541
532
  params = {}
542
533
  params[:params] = params_
543
534
  params[:raises] = raises_
544
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
545
- @annotation_stack.clear
535
+ params[:annotations] = @annotation_stack
536
+ @annotation_stack = IDL::AST::Annotations.new
546
537
  set_last(@cur.define(IDL::AST::Initializer, name, params))
547
538
  @cur
548
539
  end
@@ -551,8 +542,8 @@ class Delegator
551
542
  params = {}
552
543
  params[:params] = params_
553
544
  params[:raises] = raises_
554
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
555
- @annotation_stack.clear
545
+ params[:annotations] = @annotation_stack
546
+ @annotation_stack = IDL::AST::Annotations.new
556
547
  set_last(@cur.define(IDL::AST::Finder, name, params))
557
548
  @cur
558
549
  end
@@ -563,8 +554,7 @@ class Delegator
563
554
  namelist.each do |nm|
564
555
  n = node.resolve(nm)
565
556
  if n.nil?
566
- raise RuntimeError,
567
- "cannot find type name '#{nm}' in scope '#{node.scoped_name}'"
557
+ raise "cannot find type name '#{nm}' in scope '#{node.scoped_name}'"
568
558
  end
569
559
  node = n
570
560
  first = node if first.nil?
@@ -572,7 +562,7 @@ class Delegator
572
562
  root.introduce(first)
573
563
  case node
574
564
  when IDL::AST::Module, IDL::AST::TemplateModule,
575
- IDL::AST::Interface,IDL::AST::Home, IDL::AST::Component,
565
+ IDL::AST::Interface, IDL::AST::Home, IDL::AST::Component,
576
566
  IDL::AST::Porttype, IDL::AST::Connector,
577
567
  IDL::AST::Struct, IDL::AST::Union, IDL::AST::Typedef,
578
568
  IDL::AST::Exception, IDL::AST::Enum,
@@ -589,8 +579,7 @@ class Delegator
589
579
  when IDL::AST::Enumerator
590
580
  Expression::Enumerator.new(node)
591
581
  else
592
- raise RuntimeError,
593
- "invalid reference to #{node.class.name}: #{node.scoped_name}"
582
+ raise "invalid reference to #{node.class.name}: #{node.scoped_name}"
594
583
  end
595
584
  end
596
585
 
@@ -608,8 +597,7 @@ class Delegator
608
597
  Type::ULongLong,
609
598
  ].detect {|t| t::Range === _value }
610
599
  if _type.nil?
611
- raise RuntimeError,
612
- "it's not a valid integer: #{v.to_s}"
600
+ raise "it's not a valid integer: #{v.to_s}"
613
601
  end
614
602
  k.new(_type.new, _value)
615
603
  when :string
@@ -634,9 +622,9 @@ class Delegator
634
622
  _expression
635
623
  else
636
624
  if not ::Integer === _expression.value
637
- raise RuntimeError, "must be integer: #{_expression.value.inspect}"
625
+ raise "must be integer: #{_expression.value.inspect}"
638
626
  elsif _expression.value < 0
639
- raise RuntimeError, "must be positive integer: #{_expression.value.to_s}"
627
+ raise "must be positive integer: #{_expression.value.to_s}"
640
628
  end
641
629
  _expression.value
642
630
  end
@@ -644,8 +632,8 @@ class Delegator
644
632
 
645
633
  def define_const(_type, _name, _expression)
646
634
  params = { :type => _type, :expression => _expression }
647
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
648
- @annotation_stack.clear
635
+ params[:annotations] = @annotation_stack
636
+ @annotation_stack = IDL::AST::Annotations.new
649
637
  set_last(@cur.define(IDL::AST::Const, _name, params))
650
638
  @cur
651
639
  end
@@ -654,8 +642,8 @@ class Delegator
654
642
  params = Hash.new
655
643
  params[:oneway] = (_oneway == :oneway)
656
644
  params[:type] = _type
657
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
658
- @annotation_stack.clear
645
+ params[:annotations] = @annotation_stack
646
+ @annotation_stack = IDL::AST::Annotations.new
659
647
  set_last
660
648
  @cur = @cur.define(IDL::AST::Operation, _name, params)
661
649
  end
@@ -663,16 +651,16 @@ class Delegator
663
651
  params = Hash.new
664
652
  params[:attribute] = _attribute
665
653
  params[:type] = _type
666
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
667
- @annotation_stack.clear
654
+ params[:annotations] = @annotation_stack
655
+ @annotation_stack = IDL::AST::Annotations.new
668
656
  set_last(@cur.define(IDL::AST::Parameter, _name, params))
669
657
  @cur
670
658
  end
671
- def declare_op_footer(_raises, _context)
659
+ def declare_op_footer(_raises, instantiation_context)
672
660
  @cur.raises = _raises || []
673
- @cur.context = _context
661
+ @cur.context = instantiation_context
674
662
  if not @cur.context.nil?
675
- raise RuntimeError, "context phrase's not supported"
663
+ raise "context phrase's not supported"
676
664
  end
677
665
  set_last(@cur)
678
666
  @cur = @cur.enclosure
@@ -682,31 +670,30 @@ class Delegator
682
670
  params = Hash.new
683
671
  params[:type] = _type
684
672
  params[:readonly] = _readonly
685
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
686
- @annotation_stack.clear
673
+ params[:annotations] = @annotation_stack
674
+ @annotation_stack = IDL::AST::Annotations.new
687
675
  set_last(@cur.define(IDL::AST::Attribute, _name, params))
688
676
  end
689
677
 
690
678
  def declare_struct(_name)
691
679
  params = { :forward => true }
692
- raise RuntimeError,
693
- "annotations with forward declaration of #{name} not allowed" unless @annotation_stack.empty?
680
+ raise "annotations with forward declaration of #{name} not allowed" unless @annotation_stack.empty?
694
681
  set_last
695
682
  @cur.define(IDL::AST::Struct, _name, params)
696
683
  @cur
697
684
  end
698
685
  def define_struct(_name)
699
686
  params = { :forward => false }
700
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
701
- @annotation_stack.clear
687
+ params[:annotations] = @annotation_stack
688
+ @annotation_stack = IDL::AST::Annotations.new
702
689
  set_last
703
690
  @cur = @cur.define(IDL::AST::Struct, _name, params)
704
691
  end
705
692
  def declare_member(_type, _name)
706
693
  params = Hash.new
707
694
  params[:type] = _type
708
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
709
- @annotation_stack.clear
695
+ params[:annotations] = @annotation_stack
696
+ @annotation_stack = IDL::AST::Annotations.new
710
697
  set_last(@cur.define(IDL::AST::Member, _name, params))
711
698
  @cur
712
699
  end
@@ -719,8 +706,8 @@ class Delegator
719
706
  end
720
707
  def define_exception(_name)
721
708
  params = { :forward => false }
722
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
723
- @annotation_stack.clear
709
+ params[:annotations] = @annotation_stack
710
+ @annotation_stack = IDL::AST::Annotations.new
724
711
  set_last
725
712
  @cur = @cur.define(IDL::AST::Exception, _name, params)
726
713
  end
@@ -733,31 +720,30 @@ class Delegator
733
720
 
734
721
  def declare_union(_name)
735
722
  params = { :forward => true }
736
- raise RuntimeError,
737
- "annotations with forward declaration of #{name} not allowed" unless @annotation_stack.empty?
723
+ raise "annotations with forward declaration of #{name} not allowed" unless @annotation_stack.empty?
738
724
  set_last
739
725
  @cur.define(IDL::AST::Union, _name, params)
740
726
  @cur
741
727
  end
742
728
  def define_union(_name)
743
729
  params = { :forward => false }
744
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
745
- @annotation_stack.clear
730
+ params[:annotations] = @annotation_stack
731
+ @annotation_stack = IDL::AST::Annotations.new
746
732
  set_last
747
733
  @cur = @cur.define(IDL::AST::Union, _name, params)
748
734
  end
749
735
  def define_union_switchtype(union_node, switchtype)
750
736
  union_node.set_switchtype(switchtype)
751
- union_node.annotations.concat(@annotation_stack) unless @annotation_stack.empty?
752
- @annotation_stack.clear
737
+ union_node.annotations.concat(@annotation_stack)
738
+ @annotation_stack = IDL::AST::Annotations.new
753
739
  union_node
754
740
  end
755
741
  def define_case(_labels, _type, _name)
756
742
  params = Hash.new
757
743
  params[:type] = _type
758
744
  params[:labels] = _labels
759
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
760
- @annotation_stack.clear
745
+ params[:annotations] = @annotation_stack
746
+ @annotation_stack = IDL::AST::Annotations.new
761
747
  set_last(@cur.define(IDL::AST::UnionMember, _name, params))
762
748
  @cur
763
749
  end
@@ -772,8 +758,8 @@ class Delegator
772
758
 
773
759
  def define_enum(_name)
774
760
  params = {}
775
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
776
- @annotation_stack.clear
761
+ params[:annotations] = @annotation_stack
762
+ @annotation_stack = IDL::AST::Annotations.new
777
763
  set_last
778
764
  @cur = @cur.define(IDL::AST::Enum, _name, params)
779
765
  end
@@ -783,8 +769,8 @@ class Delegator
783
769
  :value => n,
784
770
  :enum => @cur
785
771
  }
786
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
787
- @annotation_stack.clear
772
+ params[:annotations] = @annotation_stack
773
+ @annotation_stack = IDL::AST::Annotations.new
788
774
  set_last(@cur.enclosure.define(IDL::AST::Enumerator, _name, params))
789
775
  @cur
790
776
  end
@@ -798,8 +784,8 @@ class Delegator
798
784
  def declare_typedef(_type, _name)
799
785
  params = Hash.new
800
786
  params[:type] = _type
801
- params[:annotations] = @annotation_stack.dup unless @annotation_stack.empty?
802
- @annotation_stack.clear
787
+ params[:annotations] = @annotation_stack
788
+ @annotation_stack = IDL::AST::Annotations.new
803
789
  set_last(@cur.define(IDL::AST::Typedef, _name, params))
804
790
  @cur
805
791
  end