ridl 2.7.0 → 2.7.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 +4 -4
- data/README.rdoc +2 -1
- data/lib/ridl/delegate.rb +16 -25
- data/lib/ridl/expression.rb +7 -14
- data/lib/ridl/genfile.rb +6 -6
- data/lib/ridl/node.rb +108 -159
- data/lib/ridl/options.rb +1 -1
- data/lib/ridl/optparse_ext.rb +7 -6
- data/lib/ridl/runner.rb +2 -2
- data/lib/ridl/scanner.rb +1 -2
- data/lib/ridl/type.rb +5 -5
- data/lib/ridl/version.rb +3 -3
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87ce802ae63d060ff0417d998795740726aaf67f631484735aa56191404bf78d
|
4
|
+
data.tar.gz: 888f4de7ff1a2146928c42b60298d6662d765dd7406c43287457182a81deb4ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3c4384299da19d91f593c578003615949962270392ee9293296341bd15ccf72c29cd8e304feefc777d2d408b36b67c830f44154b27d86589c98b79e32ec9e7d
|
7
|
+
data.tar.gz: 8717656df74c22c74e23acbf8e80748e646ece8be1e68131126c5d58e64ce093c038e9687b44c8042a119bc66bbb2b77ab73001a7678b234ca1b7f6c8d5710e0
|
data/README.rdoc
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
{<img src="https://badge.fury.io/rb/ridl.svg" alt="Gem Version" />}[https://badge.fury.io/rb/ridl]
|
2
2
|
{<img src="https://dev.azure.com/remedyit/axcioma/_apis/build/status/ridl?branchName=master" alt="Azure pipeline" />}[https://dev.azure.com/remedyit/axcioma/_build?definitionId=7&_a=summary]
|
3
|
+
{<img src="https://www.codefactor.io/repository/github/remedyit/ridl/badge" alt="CodeFactor" />}[https://www.codefactor.io/repository/github/remedyit/ridl]
|
3
4
|
|
4
5
|
= RIDL Compiler
|
5
6
|
|
@@ -44,4 +45,4 @@ The RIDL Gem is a Ruby-only Gem without any dependencies.
|
|
44
45
|
|
45
46
|
== Releasing new RIDL Ruby Gem
|
46
47
|
|
47
|
-
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}
|
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/delegate.rb
CHANGED
@@ -25,7 +25,7 @@ class Delegator
|
|
25
25
|
@@pragma_handlers = {}
|
26
26
|
|
27
27
|
def self.add_pragma_handler(key, h = nil, &block)
|
28
|
-
raise
|
28
|
+
raise 'add_pragma_handler requires a callable object or a block' unless (h && h.respond_to?(:call)) || block_given?
|
29
29
|
@@pragma_handlers[key] = block_given? ? block : h
|
30
30
|
end
|
31
31
|
|
@@ -201,7 +201,7 @@ class Delegator
|
|
201
201
|
when IDL::AST::Enumerator
|
202
202
|
w.visit_enumerator(m)
|
203
203
|
else
|
204
|
-
raise
|
204
|
+
raise "Invalid IDL member type for walkthrough: #{m.class.name}"
|
205
205
|
end
|
206
206
|
end
|
207
207
|
|
@@ -304,7 +304,7 @@ class Delegator
|
|
304
304
|
|
305
305
|
def define_template_module(global, names)
|
306
306
|
if global || names.size>1
|
307
|
-
raise
|
307
|
+
raise "no scoped identifier allowed for template module: #{(global ? '::' : '')+names.join('::')}"
|
308
308
|
end
|
309
309
|
@cur = @cur.define(IDL::AST::TemplateModule, names[0])
|
310
310
|
@cur.annotations.concat(@annotation_stack) unless @annotation_stack.empty?
|
@@ -332,7 +332,7 @@ class Delegator
|
|
332
332
|
@template_module_name = nil # reset
|
333
333
|
template_type = parse_scopedname(*tmp)
|
334
334
|
unless template_type.node.is_a?(IDL::AST::TemplateModule)
|
335
|
-
raise
|
335
|
+
raise "invalid module template specification: #{template_type.node.typename} #{template_type.node.scoped_lm_name}"
|
336
336
|
end
|
337
337
|
params = { :template => template_type.node, :template_params => parameters }
|
338
338
|
mod_inst = @cur.define(IDL::AST::Module, name, params)
|
@@ -358,8 +358,7 @@ class Delegator
|
|
358
358
|
params[:local] = attrib == :local
|
359
359
|
params[:forward] = true
|
360
360
|
params[:pseudo] = false
|
361
|
-
raise
|
362
|
-
"annotations with forward declaration of #{name} not allowed" unless @annotation_stack.empty?
|
361
|
+
raise "annotations with forward declaration of #{name} not allowed" unless @annotation_stack.empty?
|
363
362
|
@cur.define(IDL::AST::Interface, name, params)
|
364
363
|
set_last
|
365
364
|
@cur
|
@@ -402,8 +401,7 @@ class Delegator
|
|
402
401
|
def declare_component(name)
|
403
402
|
params = {}
|
404
403
|
params[:forward] = true
|
405
|
-
raise
|
406
|
-
"annotations with forward declaration of #{name} not allowed" unless @annotation_stack.empty?
|
404
|
+
raise "annotations with forward declaration of #{name} not allowed" unless @annotation_stack.empty?
|
407
405
|
set_last
|
408
406
|
@cur.define(IDL::AST::Component, name, params)
|
409
407
|
end
|
@@ -465,8 +463,7 @@ class Delegator
|
|
465
463
|
params = {}
|
466
464
|
params[:abstract] = attrib == :abstract
|
467
465
|
params[:forward] = true
|
468
|
-
raise
|
469
|
-
"annotations with forward declaration of #{name} not allowed" unless @annotation_stack.empty?
|
466
|
+
raise "annotations with forward declaration of #{name} not allowed" unless @annotation_stack.empty?
|
470
467
|
set_last
|
471
468
|
@cur.define(IDL::AST::Eventtype, name, params)
|
472
469
|
@cur
|
@@ -489,8 +486,7 @@ class Delegator
|
|
489
486
|
params = {}
|
490
487
|
params[:abstract] = attrib == :abstract
|
491
488
|
params[:forward] = true
|
492
|
-
raise
|
493
|
-
"annotations with forward declaration of #{name} not allowed" unless @annotation_stack.empty?
|
489
|
+
raise "annotations with forward declaration of #{name} not allowed" unless @annotation_stack.empty?
|
494
490
|
set_last
|
495
491
|
@cur.define(IDL::AST::Valuetype, name, params)
|
496
492
|
@cur
|
@@ -562,8 +558,7 @@ class Delegator
|
|
562
558
|
namelist.each do |nm|
|
563
559
|
n = node.resolve(nm)
|
564
560
|
if n.nil?
|
565
|
-
raise
|
566
|
-
"cannot find type name '#{nm}' in scope '#{node.scoped_name}'"
|
561
|
+
raise "cannot find type name '#{nm}' in scope '#{node.scoped_name}'"
|
567
562
|
end
|
568
563
|
node = n
|
569
564
|
first = node if first.nil?
|
@@ -588,8 +583,7 @@ class Delegator
|
|
588
583
|
when IDL::AST::Enumerator
|
589
584
|
Expression::Enumerator.new(node)
|
590
585
|
else
|
591
|
-
raise
|
592
|
-
"invalid reference to #{node.class.name}: #{node.scoped_name}"
|
586
|
+
raise "invalid reference to #{node.class.name}: #{node.scoped_name}"
|
593
587
|
end
|
594
588
|
end
|
595
589
|
|
@@ -607,8 +601,7 @@ class Delegator
|
|
607
601
|
Type::ULongLong,
|
608
602
|
].detect {|t| t::Range === _value }
|
609
603
|
if _type.nil?
|
610
|
-
raise
|
611
|
-
"it's not a valid integer: #{v.to_s}"
|
604
|
+
raise "it's not a valid integer: #{v.to_s}"
|
612
605
|
end
|
613
606
|
k.new(_type.new, _value)
|
614
607
|
when :string
|
@@ -633,9 +626,9 @@ class Delegator
|
|
633
626
|
_expression
|
634
627
|
else
|
635
628
|
if not ::Integer === _expression.value
|
636
|
-
raise
|
629
|
+
raise "must be integer: #{_expression.value.inspect}"
|
637
630
|
elsif _expression.value < 0
|
638
|
-
raise
|
631
|
+
raise "must be positive integer: #{_expression.value.to_s}"
|
639
632
|
end
|
640
633
|
_expression.value
|
641
634
|
end
|
@@ -671,7 +664,7 @@ class Delegator
|
|
671
664
|
@cur.raises = _raises || []
|
672
665
|
@cur.context = _context
|
673
666
|
if not @cur.context.nil?
|
674
|
-
raise
|
667
|
+
raise "context phrase's not supported"
|
675
668
|
end
|
676
669
|
set_last(@cur)
|
677
670
|
@cur = @cur.enclosure
|
@@ -688,8 +681,7 @@ class Delegator
|
|
688
681
|
|
689
682
|
def declare_struct(_name)
|
690
683
|
params = { :forward => true }
|
691
|
-
raise
|
692
|
-
"annotations with forward declaration of #{name} not allowed" unless @annotation_stack.empty?
|
684
|
+
raise "annotations with forward declaration of #{name} not allowed" unless @annotation_stack.empty?
|
693
685
|
set_last
|
694
686
|
@cur.define(IDL::AST::Struct, _name, params)
|
695
687
|
@cur
|
@@ -732,8 +724,7 @@ class Delegator
|
|
732
724
|
|
733
725
|
def declare_union(_name)
|
734
726
|
params = { :forward => true }
|
735
|
-
raise
|
736
|
-
"annotations with forward declaration of #{name} not allowed" unless @annotation_stack.empty?
|
727
|
+
raise "annotations with forward declaration of #{name} not allowed" unless @annotation_stack.empty?
|
737
728
|
set_last
|
738
729
|
@cur.define(IDL::AST::Union, _name, params)
|
739
730
|
@cur
|
data/lib/ridl/expression.rb
CHANGED
@@ -37,8 +37,7 @@ module IDL
|
|
37
37
|
def initialize(node)
|
38
38
|
if $DEBUG
|
39
39
|
unless IDL::AST::Const === node || (IDL::AST::TemplateParam === node && node.idltype.is_a?(IDL::Type::Const))
|
40
|
-
raise
|
41
|
-
"#{node.scoped_name} must be constant: #{node.class.name}."
|
40
|
+
raise "#{node.scoped_name} must be constant: #{node.class.name}."
|
42
41
|
end
|
43
42
|
end
|
44
43
|
@node = node
|
@@ -69,8 +68,7 @@ module IDL
|
|
69
68
|
def initialize(node)
|
70
69
|
if $DEBUG
|
71
70
|
if not IDL::AST::Enumerator === node
|
72
|
-
raise
|
73
|
-
"#{node.scoped_name} must be enumerator: #{node.class.name}."
|
71
|
+
raise "#{node.scoped_name} must be enumerator: #{node.class.name}."
|
74
72
|
end
|
75
73
|
end
|
76
74
|
@node = node
|
@@ -87,8 +85,7 @@ module IDL
|
|
87
85
|
n = self.class::NUMBER_OF_OPERANDS
|
88
86
|
|
89
87
|
if _operands.size != n
|
90
|
-
raise
|
91
|
-
format("%s must receive %d operand%s.",
|
88
|
+
raise format("%s must receive %d operand%s.",
|
92
89
|
self.typename, n, if (n>1) then "s" else "" end)
|
93
90
|
end
|
94
91
|
|
@@ -114,8 +111,7 @@ module IDL
|
|
114
111
|
def Operation.suite_type(*types)
|
115
112
|
types.each do |t|
|
116
113
|
if not self::Applicable.include? t.class
|
117
|
-
raise
|
118
|
-
"#{self.name} cannot be applicable for #{t.typename}"
|
114
|
+
raise "#{self.name} cannot be applicable for #{t.typename}"
|
119
115
|
end
|
120
116
|
end
|
121
117
|
|
@@ -173,8 +169,7 @@ module IDL
|
|
173
169
|
|
174
170
|
t = IDL::Type::Boolean
|
175
171
|
if (t1 == t && t2 != t) or (t1 != t && t2 == t)
|
176
|
-
raise
|
177
|
-
"#{self.name} about #{t1.typename} and #{t2.typename} is illegal."
|
172
|
+
raise "#{self.name} about #{t1.typename} and #{t2.typename} is illegal."
|
178
173
|
end
|
179
174
|
end
|
180
175
|
end
|
@@ -191,8 +186,7 @@ module IDL
|
|
191
186
|
# it's expected that Double, LongDouble is a Float.
|
192
187
|
s1,s2 = IDL::Type::Float, IDL::Type::Fixed
|
193
188
|
if (t1 === s1 && t2 === s2) or (t1 === s2 && t2 === s1)
|
194
|
-
raise
|
195
|
-
"#{self.name} about #{t1.typename} and #{t2.typename} is illegal."
|
189
|
+
raise "#{self.name} about #{t1.typename} and #{t2.typename} is illegal."
|
196
190
|
end
|
197
191
|
end
|
198
192
|
end
|
@@ -237,8 +231,7 @@ module IDL
|
|
237
231
|
protected
|
238
232
|
def check_rop(rop)
|
239
233
|
if not (0...64) === rop
|
240
|
-
raise
|
241
|
-
"right operand for shift must be in the range 0 <= right operand < 64: #{rop}."
|
234
|
+
raise "right operand for shift must be in the range 0 <= right operand < 64: #{rop}."
|
242
235
|
end
|
243
236
|
end
|
244
237
|
end
|
data/lib/ridl/genfile.rb
CHANGED
@@ -109,7 +109,7 @@ module IDL
|
|
109
109
|
:output_file => nil,
|
110
110
|
:create_missing_dir => false
|
111
111
|
}.merge(opts)
|
112
|
-
if @options[:regenerate] && File.
|
112
|
+
if @options[:regenerate] && File.exist?(@fullpath)
|
113
113
|
parse_regeneration_content
|
114
114
|
else
|
115
115
|
@content = Content.new
|
@@ -159,7 +159,7 @@ module IDL
|
|
159
159
|
fgen = @fout
|
160
160
|
@fout = nil
|
161
161
|
fgen.close(false) # close but do NOT unlink
|
162
|
-
if File.
|
162
|
+
if File.exist?(@fullpath)
|
163
163
|
# create temporary backup
|
164
164
|
ftmp = Tempfile.new(@name)
|
165
165
|
ftmp_name = ftmp.path.dup
|
@@ -224,22 +224,22 @@ module IDL
|
|
224
224
|
if regen_marker_re =~ line
|
225
225
|
case $1
|
226
226
|
when 'BEGIN'
|
227
|
-
raise
|
227
|
+
raise "ERROR: Found unterminated regeneration section starting at #{@path}:#{in_section.last}." if in_section
|
228
228
|
in_section = [$2, linenr]
|
229
229
|
section = []
|
230
230
|
when 'END'
|
231
|
-
raise
|
231
|
+
raise "ERROR: Found unmatched regeneration end at #{@path}:#{linenr}." unless in_section && ($2 == in_section.first)
|
232
232
|
sections[$2] = section
|
233
233
|
in_section = nil
|
234
234
|
section = []
|
235
235
|
when 'HEADER_END'
|
236
|
-
raise
|
236
|
+
raise "ERROR: Found illegal header end marker at #{@path}:#{linenr}." unless _keep_header && in_section &&
|
237
237
|
('HEADER' == in_section.first ) && (0 == in_section.last)
|
238
238
|
sections[$2] = section
|
239
239
|
in_section = nil
|
240
240
|
section = []
|
241
241
|
else
|
242
|
-
raise
|
242
|
+
raise "ERROR: Found invalid regeneration marker at #{@path}:#{linenr}."
|
243
243
|
end
|
244
244
|
elsif in_section
|
245
245
|
section << line
|
data/lib/ridl/node.rb
CHANGED
@@ -159,24 +159,22 @@ module IDL::AST
|
|
159
159
|
def set_repo_id(id)
|
160
160
|
if @repo_id
|
161
161
|
if id != @repo_id
|
162
|
-
raise
|
163
|
-
"#{self.scoped_name} already has a different repository ID assigned: #{@repo_id}"
|
162
|
+
raise "#{self.scoped_name} already has a different repository ID assigned: #{@repo_id}"
|
164
163
|
end
|
165
164
|
end
|
166
165
|
id_arr = id.split(':')
|
167
166
|
if @repo_ver
|
168
167
|
if id_arr.first != 'IDL' or id_arr.last != @repo_ver
|
169
|
-
raise
|
170
|
-
"supplied repository ID (#{id}) does not match previously assigned repository version for #{self.scoped_name} = #{@repo_ver}"
|
168
|
+
raise "supplied repository ID (#{id}) does not match previously assigned repository version for #{self.scoped_name} = #{@repo_ver}"
|
171
169
|
end
|
172
170
|
end
|
173
171
|
# check validity of IDL format repo IDs
|
174
172
|
if id_arr.first == 'IDL'
|
175
173
|
id_arr.shift
|
176
174
|
id_str = id_arr.shift.to_s
|
177
|
-
raise
|
178
|
-
raise
|
179
|
-
raise
|
175
|
+
raise 'ID identifiers should not start or end with \'/\'' if id_str[0,1]=='/' or id_str[-1, 1]=='/'
|
176
|
+
raise "ID identifiers should not start with one of '#{REPO_ID_XCHARS.join("', '")}'" if REPO_ID_XCHARS.include?(id_str[0,1])
|
177
|
+
raise 'Invalid ID! Only a..z, A..Z, 0..9, \'.\', \'-\', \'_\' or \'\/\' allowed for identifiers' unless REPO_ID_RE =~ id_str
|
180
178
|
end
|
181
179
|
@repo_id = id
|
182
180
|
end
|
@@ -185,15 +183,13 @@ module IDL::AST
|
|
185
183
|
ver = "#{ma}.#{mi}"
|
186
184
|
if @repo_ver
|
187
185
|
if ver != @repo_ver
|
188
|
-
raise
|
189
|
-
"#{self.scoped_name} already has a repository version assigned: #{@repo_ver}"
|
186
|
+
raise "#{self.scoped_name} already has a repository version assigned: #{@repo_ver}"
|
190
187
|
end
|
191
188
|
end
|
192
189
|
if @repo_id
|
193
190
|
l = @repo_id.split(':')
|
194
191
|
if l.last != ver
|
195
|
-
raise
|
196
|
-
"supplied repository version (#{ver}) does not match previously assigned repository ID for #{self.scoped_name}: #{@repo_id}"
|
192
|
+
raise "supplied repository version (#{ver}) does not match previously assigned repository ID for #{self.scoped_name}: #{@repo_id}"
|
197
193
|
end
|
198
194
|
end
|
199
195
|
@repo_ver = ver
|
@@ -201,9 +197,9 @@ module IDL::AST
|
|
201
197
|
|
202
198
|
def prefix=(pfx)
|
203
199
|
unless pfx.to_s.empty?
|
204
|
-
raise
|
205
|
-
raise
|
206
|
-
raise
|
200
|
+
raise 'ID prefix should not start or end with \'/\'' if pfx[0,1]=='/' or pfx[-1, 1]=='/'
|
201
|
+
raise "ID prefix should not start with one of '#{REPO_ID_XCHARS.join("', '")}'" if REPO_ID_XCHARS.include?(pfx[0,1])
|
202
|
+
raise 'Invalid ID prefix! Only a..z, A..Z, 0..9, \'.\', \'-\', \'_\' or \'\/\' allowed' unless REPO_ID_RE =~ pfx
|
207
203
|
end
|
208
204
|
self._set_prefix(pfx)
|
209
205
|
end
|
@@ -270,8 +266,7 @@ module IDL::AST
|
|
270
266
|
|
271
267
|
def introduce(node)
|
272
268
|
n = (@introduced[node.intern] ||= node)
|
273
|
-
raise
|
274
|
-
"#{node.name} is already introduced as a #{n.scoped_name} of #{n.typename}." if n != node
|
269
|
+
raise "#{node.name} is already introduced as a #{n.scoped_name} of #{n.typename}." if n != node
|
275
270
|
end
|
276
271
|
|
277
272
|
def undo_introduction(node)
|
@@ -279,7 +274,7 @@ module IDL::AST
|
|
279
274
|
end
|
280
275
|
|
281
276
|
def redefine(node, params)
|
282
|
-
raise
|
277
|
+
raise "\"#{node.name}\" is already defined."
|
283
278
|
end
|
284
279
|
|
285
280
|
def is_definable?(_type)
|
@@ -290,8 +285,7 @@ module IDL::AST
|
|
290
285
|
|
291
286
|
def define(_type, _name, params = Hash.new)
|
292
287
|
if not is_definable?(_type)
|
293
|
-
raise
|
294
|
-
"#{_type.to_s} is not definable in #{self.typename}."
|
288
|
+
raise "#{_type.to_s} is not definable in #{self.typename}."
|
295
289
|
end
|
296
290
|
node = search_self(_name)
|
297
291
|
if node.nil?
|
@@ -302,8 +296,7 @@ module IDL::AST
|
|
302
296
|
@children << node
|
303
297
|
else
|
304
298
|
if _type != node.class
|
305
|
-
raise
|
306
|
-
"#{_name} is already defined as a type of #{node.typename}"
|
299
|
+
raise "#{_name} is already defined as a type of #{node.typename}"
|
307
300
|
end
|
308
301
|
node = redefine(node, params)
|
309
302
|
end
|
@@ -342,7 +335,7 @@ module IDL::AST
|
|
342
335
|
key = _name.downcase.intern
|
343
336
|
node = @introduced[key]
|
344
337
|
if not node.nil? and node.name != _name
|
345
|
-
raise
|
338
|
+
raise "\"#{_name}\" clashed with \"#{node.name}\"."
|
346
339
|
end
|
347
340
|
node
|
348
341
|
end
|
@@ -493,10 +486,10 @@ module IDL::AST
|
|
493
486
|
# forward declaration in different scope (other module section in same file or other file)
|
494
487
|
elsif node.is_defined?
|
495
488
|
# multiple full declarations are illegal
|
496
|
-
raise
|
489
|
+
raise "#{node.typename} \"#{node.name}\" is already defined."
|
497
490
|
end
|
498
491
|
if (node.is_abstract? != params[:abstract]) || (node.is_local? != params[:local]) || (node.is_pseudo? != params[:pseudo])
|
499
|
-
raise
|
492
|
+
raise "\"attributes are not the same: \"#{node.name}\"."
|
500
493
|
end
|
501
494
|
|
502
495
|
_intf = IDL::AST::Interface.new(node.name, self, params)
|
@@ -521,10 +514,10 @@ module IDL::AST
|
|
521
514
|
node.annotations.concat(params[:annotations])
|
522
515
|
return node if params[:forward]
|
523
516
|
if node.is_defined?
|
524
|
-
raise
|
517
|
+
raise "#{node.typename} \"#{node.name}\" is already defined."
|
525
518
|
end
|
526
519
|
if (node.is_abstract? != params[:abstract])
|
527
|
-
raise
|
520
|
+
raise "\"attributes are not the same: \"#{node.name}\"."
|
528
521
|
end
|
529
522
|
|
530
523
|
_new_node = node.class.new(node.name, self, params)
|
@@ -543,7 +536,7 @@ module IDL::AST
|
|
543
536
|
node.annotations.concat(params[:annotations])
|
544
537
|
return node if params[:forward]
|
545
538
|
if node.is_defined?
|
546
|
-
raise
|
539
|
+
raise "#{node.typename} \"#{node.name}\" is already defined."
|
547
540
|
end
|
548
541
|
|
549
542
|
_new_node = node.class.new(node.name, self, params)
|
@@ -561,8 +554,7 @@ module IDL::AST
|
|
561
554
|
|
562
555
|
return _new_node
|
563
556
|
end
|
564
|
-
raise
|
565
|
-
"#{node.name} is already introduced as #{node.typename} #{node.scoped_name}."
|
557
|
+
raise "#{node.name} is already introduced as #{node.typename} #{node.scoped_name}."
|
566
558
|
end
|
567
559
|
|
568
560
|
def undo_introduction(node)
|
@@ -629,7 +621,7 @@ module IDL::AST
|
|
629
621
|
_key = _name.downcase.intern
|
630
622
|
node = @introduced[_key]
|
631
623
|
if not node.nil? and node.name != _name
|
632
|
-
raise
|
624
|
+
raise "\"#{_name}\" clashed with \"#{node.name}\"."
|
633
625
|
end
|
634
626
|
if node.nil? && @next
|
635
627
|
node = @next.search_links(_name)
|
@@ -696,7 +688,7 @@ module IDL::AST
|
|
696
688
|
# referenced template node should have been instantiated already and available through context
|
697
689
|
_context[_node]
|
698
690
|
end
|
699
|
-
raise
|
691
|
+
raise "cannot resolve concrete node for template #{_node.typename} #{_node.scoped_lm_name}" unless _cnode
|
700
692
|
_cnode
|
701
693
|
else
|
702
694
|
_node
|
@@ -736,14 +728,13 @@ module IDL::AST
|
|
736
728
|
def instantiate(_module_instance, _context = {})
|
737
729
|
# process concrete parameters
|
738
730
|
@template_params.each_with_index do |_tp, _ix|
|
739
|
-
raise
|
740
|
-
"missing template parameter for #{typename} #{scoped_lm_name}: #{_tp.name}" unless _ix < _module_instance.template_params.size
|
731
|
+
raise "missing template parameter for #{typename} #{scoped_lm_name}: #{_tp.name}" unless _ix < _module_instance.template_params.size
|
741
732
|
_cp = _module_instance.template_params[_ix]
|
742
733
|
if _cp.is_a?(IDL::Type)
|
743
|
-
raise
|
734
|
+
raise "anonymous type definitions are not allowed!" if _cp.is_anonymous?
|
744
735
|
# parameter should be a matching IDL::Type
|
745
736
|
unless _tp.idltype.is_a?(IDL::Type::Any) || _tp.idltype.class === _cp.resolved_type
|
746
|
-
raise
|
737
|
+
raise "mismatched instantiation parameter \##{_ix} #{_cp.typename} for #{typename} #{scoped_lm_name}: expected #{_tp.idltype.typename} for #{_tp.name}"
|
747
738
|
end
|
748
739
|
# verify concrete parameter
|
749
740
|
case _tp.idltype
|
@@ -764,19 +755,19 @@ module IDL::AST
|
|
764
755
|
unless _tptype.basetype.is_a?(IDL::Type::ScopedName) &&
|
765
756
|
_tptype.basetype.is_node?(IDL::AST::TemplateParam) &&
|
766
757
|
_tptype.basetype.node.concrete_matches?(_cp.resolved_type.basetype)
|
767
|
-
raise
|
758
|
+
raise "invalid sequence type as instantiation parameter for #{typename} #{scoped_lm_name}: expected #{_tp.idltype.typename} for #{_tp.name}"
|
768
759
|
end
|
769
760
|
end
|
770
761
|
end
|
771
762
|
elsif _cp.is_a?(IDL::Expression)
|
772
763
|
# template param should be 'const <const_type>'
|
773
764
|
unless _tp.idltype.is_a?(IDL::Type::Const)
|
774
|
-
raise
|
765
|
+
raise "unexpected expression as instantiation parameter for #{typename} #{scoped_lm_name}: expected #{_tp.idltype.typename} for #{_tp.name}"
|
775
766
|
end
|
776
767
|
# match constant type
|
777
768
|
_tp.idltype.narrow(_cp.value)
|
778
769
|
else
|
779
|
-
raise
|
770
|
+
raise "invalid instantiation parameter for #{typename} #{scoped_lm_name}: #{_cp.class.name}"
|
780
771
|
end
|
781
772
|
# if we get here all is well -> store concrete param
|
782
773
|
_tp.set_concrete_param(_cp.is_a?(IDL::Type::ScopedName) ? _cp.node : _cp)
|
@@ -797,12 +788,12 @@ module IDL::AST
|
|
797
788
|
def initialize(_name, _enclosure, _params)
|
798
789
|
super(_name, _enclosure)
|
799
790
|
unless _params[:tpl_type].is_a?(IDL::Type::ScopedName) && _params[:tpl_type].is_node?(IDL::AST::TemplateModule)
|
800
|
-
raise
|
791
|
+
raise "templated module reference type required for #{typename} #{scoped_lm_name}: got #{_params[:tpl_type].typename}"
|
801
792
|
end
|
802
793
|
@template = _params[:tpl_type].resolved_type.node
|
803
794
|
_params[:tpl_params].each do |p|
|
804
795
|
unless (p.is_a?(IDL::Type::ScopedName) || p.is_a?(IDL::Expression::ScopedName)) && p.is_node?(IDL::AST::TemplateParam)
|
805
|
-
raise
|
796
|
+
raise "invalid template module parameter for template module reference #{typename} #{scoped_lm_name}: #{p.typename}"
|
806
797
|
end
|
807
798
|
end
|
808
799
|
@params = _params[:tpl_params].collect { |p| p.resolved_node }
|
@@ -940,7 +931,7 @@ module IDL::AST
|
|
940
931
|
r_one = results.shift
|
941
932
|
unless results.all? {|r| r_one == r || (r_one.class == r.class && r_one.scoped_name == r.scoped_name) }
|
942
933
|
s = results.inject([r_one]) {|l,r| l << r unless l.include?(r); l }.collect{ |n| n.scoped_name }.join(", ")
|
943
|
-
raise
|
934
|
+
raise "\"#{_name}\" is ambiguous. " + s
|
944
935
|
end
|
945
936
|
end
|
946
937
|
results.first
|
@@ -1026,37 +1017,29 @@ module IDL::AST
|
|
1026
1017
|
inherits_.each do |tc|
|
1027
1018
|
unless tc.is_a?(IDL::Type::ScopedName) && tc.is_node?(IDL::AST::TemplateParam)
|
1028
1019
|
unless (tc.is_a?(IDL::Type::ScopedName) && tc.is_node?(IDL::AST::Interface))
|
1029
|
-
raise
|
1030
|
-
"invalid inheritance identifier for #{typename} #{scoped_lm_name}: #{tc.typename}"
|
1020
|
+
raise "invalid inheritance identifier for #{typename} #{scoped_lm_name}: #{tc.typename}"
|
1031
1021
|
end
|
1032
1022
|
rtc = tc.resolved_type
|
1033
1023
|
if rtc.node.has_ancestor?(self)
|
1034
|
-
raise
|
1035
|
-
"circular inheritance detected for #{typename} #{scoped_lm_name}: #{tc.node.scoped_lm_name} is descendant"
|
1024
|
+
raise "circular inheritance detected for #{typename} #{scoped_lm_name}: #{tc.node.scoped_lm_name} is descendant"
|
1036
1025
|
end
|
1037
1026
|
if not rtc.node.is_defined?
|
1038
|
-
raise
|
1039
|
-
"#{typename} #{scoped_lm_name} cannot inherit from forward declared #{tc.node.typename} #{tc.node.scoped_lm_name}"
|
1027
|
+
raise "#{typename} #{scoped_lm_name} cannot inherit from forward declared #{tc.node.typename} #{tc.node.scoped_lm_name}"
|
1040
1028
|
end
|
1041
1029
|
if rtc.node.is_local? and not self.is_local?
|
1042
|
-
raise
|
1043
|
-
"#{typename} #{scoped_lm_name} cannot inherit from 'local' #{tc.node.typename} #{tc.node.scoped_lm_name}"
|
1030
|
+
raise "#{typename} #{scoped_lm_name} cannot inherit from 'local' #{tc.node.typename} #{tc.node.scoped_lm_name}"
|
1044
1031
|
end
|
1045
1032
|
if rtc.node.is_pseudo? and not self.is_pseudo?
|
1046
|
-
raise
|
1047
|
-
"#{typename} #{scoped_lm_name} cannot inherit from 'pseudo' #{tc.node.typename} #{tc.node.scoped_lm_name}"
|
1033
|
+
raise "#{typename} #{scoped_lm_name} cannot inherit from 'pseudo' #{tc.node.typename} #{tc.node.scoped_lm_name}"
|
1048
1034
|
end
|
1049
1035
|
if self.is_abstract? and not rtc.node.is_abstract?
|
1050
|
-
raise
|
1051
|
-
"'abstract' #{typename} #{scoped_lm_name} cannot inherit from non-'abstract' #{tc.node.typename} #{tc.node.scoped_lm_name}"
|
1036
|
+
raise "'abstract' #{typename} #{scoped_lm_name} cannot inherit from non-'abstract' #{tc.node.typename} #{tc.node.scoped_lm_name}"
|
1052
1037
|
end
|
1053
1038
|
if self.is_local? and rtc.node.is_abstract?
|
1054
|
-
raise
|
1055
|
-
"'local' #{typename} #{scoped_lm_name} cannot inherit from 'abstract' #{tc.node.typename} #{tc.node.scoped_lm_name}"
|
1039
|
+
raise "'local' #{typename} #{scoped_lm_name} cannot inherit from 'abstract' #{tc.node.typename} #{tc.node.scoped_lm_name}"
|
1056
1040
|
end
|
1057
1041
|
if self.has_base?(rtc.node)
|
1058
|
-
raise
|
1059
|
-
"#{typename} #{scoped_lm_name} cannot inherit from #{tc.node.typename} #{tc.node.scoped_lm_name} multiple times"
|
1042
|
+
raise "#{typename} #{scoped_lm_name} cannot inherit from #{tc.node.typename} #{tc.node.scoped_lm_name} multiple times"
|
1060
1043
|
end
|
1061
1044
|
# check if we indirectly derive from this base multiple times (which is ok; no further need to check)
|
1062
1045
|
unless @resolved_bases.any? { |b| b.has_ancestor?(rtc.node) }
|
@@ -1066,8 +1049,7 @@ module IDL::AST
|
|
1066
1049
|
new_op_att_ << m if m.is_a?(IDL::AST::Operation) || m.is_a?(IDL::AST::Attribute)
|
1067
1050
|
end
|
1068
1051
|
if new_op_att_.any? {|n| n_ = self.search_self(n.name); n_.is_a?(IDL::AST::Operation) || n_.is_a?(IDL::AST::Attribute) }
|
1069
|
-
raise
|
1070
|
-
"#{typename} #{scoped_lm_name} cannot inherit from #{tc.node.typename} #{tc.node.scoped_lm_name} because of duplicated operations/attributes"
|
1052
|
+
raise "#{typename} #{scoped_lm_name} cannot inherit from #{tc.node.typename} #{tc.node.scoped_lm_name} because of duplicated operations/attributes"
|
1071
1053
|
end
|
1072
1054
|
# no need to check for duplicate member names; this inheritance is ok
|
1073
1055
|
end
|
@@ -1102,7 +1084,7 @@ module IDL::AST
|
|
1102
1084
|
case node
|
1103
1085
|
when IDL::AST::Struct, IDL::AST::Union
|
1104
1086
|
if node.is_defined?
|
1105
|
-
raise
|
1087
|
+
raise "#{node.typename} \"#{node.name}\" is already defined."
|
1106
1088
|
end
|
1107
1089
|
node.annotations.concat(params[:annotations])
|
1108
1090
|
|
@@ -1121,13 +1103,13 @@ module IDL::AST
|
|
1121
1103
|
|
1122
1104
|
return _new_node
|
1123
1105
|
else
|
1124
|
-
raise
|
1106
|
+
raise "#{node.typename} \"#{node.name}\" is already defined."
|
1125
1107
|
end
|
1126
1108
|
end
|
1127
1109
|
|
1128
1110
|
case node
|
1129
1111
|
when IDL::AST::Operation, IDL::AST::Attribute
|
1130
|
-
raise
|
1112
|
+
raise "#{node.typename} '#{node.scoped_lm_name}' cannot be overridden."
|
1131
1113
|
else
|
1132
1114
|
newnode = node.class.new(node.name, self, params)
|
1133
1115
|
newnode.annotations.concat(params[:annotations])
|
@@ -1193,12 +1175,10 @@ module IDL::AST
|
|
1193
1175
|
def set_base(parent)
|
1194
1176
|
unless parent.is_a?(IDL::Type::ScopedName) && parent.is_node?(IDL::AST::TemplateParam)
|
1195
1177
|
unless (parent.is_a?(IDL::Type::ScopedName) && parent.is_node?(self.class))
|
1196
|
-
raise
|
1197
|
-
"invalid inheritance identifier for #{typename} #{scoped_lm_name}: #{parent.typename}"
|
1178
|
+
raise "invalid inheritance identifier for #{typename} #{scoped_lm_name}: #{parent.typename}"
|
1198
1179
|
end
|
1199
1180
|
if parent.resolved_type.node.has_base?(self)
|
1200
|
-
raise
|
1201
|
-
"circular inheritance detected for #{typename} #{scoped_lm_name}: #{parent.node.scoped_lm_name} is descendant"
|
1181
|
+
raise "circular inheritance detected for #{typename} #{scoped_lm_name}: #{parent.node.scoped_lm_name} is descendant"
|
1202
1182
|
end
|
1203
1183
|
@resolved_base = parent.resolved_type.node
|
1204
1184
|
end
|
@@ -1217,22 +1197,18 @@ module IDL::AST
|
|
1217
1197
|
intfs.each do |tc|
|
1218
1198
|
unless tc.is_a?(IDL::Type::ScopedName) && tc.is_node?(IDL::AST::TemplateParam)
|
1219
1199
|
unless (tc.is_a?(IDL::Type::ScopedName) && tc.is_node?(IDL::AST::Interface))
|
1220
|
-
raise
|
1221
|
-
"invalid inheritance identifier for #{typename} #{scoped_lm_name}: #{tc.typename}"
|
1200
|
+
raise "invalid inheritance identifier for #{typename} #{scoped_lm_name}: #{tc.typename}"
|
1222
1201
|
end
|
1223
1202
|
rtc = tc.resolved_type
|
1224
1203
|
if not rtc.node.is_defined?
|
1225
|
-
raise
|
1226
|
-
"#{typename} #{scoped_lm_name} cannot support forward declared #{tc.node.typename} #{tc.node.scoped_lm_name}"
|
1204
|
+
raise "#{typename} #{scoped_lm_name} cannot support forward declared #{tc.node.typename} #{tc.node.scoped_lm_name}"
|
1227
1205
|
end
|
1228
1206
|
## TODO : is this legal?
|
1229
1207
|
if rtc.node.is_local?
|
1230
|
-
raise
|
1231
|
-
"#{typename} #{scoped_lm_name} cannot support 'local' #{tc.node.typename} #{tc.node.scoped_lm_name}"
|
1208
|
+
raise "#{typename} #{scoped_lm_name} cannot support 'local' #{tc.node.typename} #{tc.node.scoped_lm_name}"
|
1232
1209
|
end
|
1233
1210
|
if rtc.node.is_pseudo?
|
1234
|
-
raise
|
1235
|
-
"#{typename} #{scoped_lm_name} cannot support 'pseudo' #{tc.node.typename} #{tc.node.scoped_lm_name}"
|
1211
|
+
raise "#{typename} #{scoped_lm_name} cannot support 'pseudo' #{tc.node.typename} #{tc.node.scoped_lm_name}"
|
1236
1212
|
end
|
1237
1213
|
## TODO : is this legal?
|
1238
1214
|
#if tc.node.is_abstract?
|
@@ -1240,8 +1216,7 @@ module IDL::AST
|
|
1240
1216
|
# "'abstract' #{typename} #{scoped_lm_name} cannot support 'abstract' #{tc.node.typename} #{tc.node.scoped_lm_name}"
|
1241
1217
|
#end
|
1242
1218
|
if self.has_support?(rtc.node)
|
1243
|
-
raise
|
1244
|
-
"#{typename} #{scoped_lm_name} cannot support #{tc.node.typename} #{tc.node.scoped_lm_name} multiple times"
|
1219
|
+
raise "#{typename} #{scoped_lm_name} cannot support #{tc.node.typename} #{tc.node.scoped_lm_name} multiple times"
|
1245
1220
|
end
|
1246
1221
|
# check if we indirectly support this base multiple times (which is ok; no further need to check)
|
1247
1222
|
unless @resolved_interfaces.any? { |b| b.has_ancestor?(rtc.node) }
|
@@ -1251,8 +1226,7 @@ module IDL::AST
|
|
1251
1226
|
new_op_att_ << m if m.is_a?(IDL::AST::Operation) || m.is_a?(IDL::AST::Attribute)
|
1252
1227
|
end
|
1253
1228
|
if new_op_att_.any? {|n| n_ = self.search_self(n.name); n_.is_a?(IDL::AST::Operation) || n_.is_a?(IDL::AST::Attribute) }
|
1254
|
-
raise
|
1255
|
-
"#{typename} #{scoped_lm_name} cannot support #{tc.node.typename} #{tc.node.scoped_lm_name} because of duplicated operations/attributes"
|
1229
|
+
raise "#{typename} #{scoped_lm_name} cannot support #{tc.node.typename} #{tc.node.scoped_lm_name} because of duplicated operations/attributes"
|
1256
1230
|
end
|
1257
1231
|
# no need to check for duplicate member names; this support is ok
|
1258
1232
|
end
|
@@ -1275,7 +1249,7 @@ module IDL::AST
|
|
1275
1249
|
case node
|
1276
1250
|
when IDL::AST::Struct, IDL::AST::Union
|
1277
1251
|
if node.is_defined?
|
1278
|
-
raise
|
1252
|
+
raise "#{node.typename} \"#{node.name}\" is already defined."
|
1279
1253
|
end
|
1280
1254
|
node.annotations.concat(params[:annotations])
|
1281
1255
|
|
@@ -1294,13 +1268,13 @@ module IDL::AST
|
|
1294
1268
|
|
1295
1269
|
return _new_node
|
1296
1270
|
else
|
1297
|
-
raise
|
1271
|
+
raise "#{node.typename} \"#{node.name}\" is already defined."
|
1298
1272
|
end
|
1299
1273
|
end
|
1300
1274
|
|
1301
1275
|
case node
|
1302
1276
|
when IDL::AST::Operation, IDL::AST::Attribute
|
1303
|
-
raise
|
1277
|
+
raise "#{node.typename} '#{node.scoped_lm_name}' cannot be overridden."
|
1304
1278
|
else
|
1305
1279
|
newnode = node.class.new(node.name, self, params)
|
1306
1280
|
newnode.annotations.concat(params[:annotations])
|
@@ -1365,22 +1339,19 @@ module IDL::AST
|
|
1365
1339
|
def set_component_and_key(comp, key)
|
1366
1340
|
unless comp && comp.is_a?(IDL::Type::ScopedName) && comp.is_node?(IDL::AST::TemplateParam)
|
1367
1341
|
unless comp && comp.is_a?(IDL::Type::ScopedName) && comp.is_node?(IDL::AST::Component)
|
1368
|
-
raise
|
1369
|
-
(comp ?
|
1342
|
+
raise (comp ?
|
1370
1343
|
"invalid managed component for #{typename} #{scoped_lm_name}: #{comp.typename}" :
|
1371
1344
|
"missing managed component specification for #{typename} #{scoped_lm_name}")
|
1372
1345
|
end
|
1373
1346
|
unless comp.resolved_type.node.is_defined?
|
1374
|
-
raise
|
1375
|
-
"#{scoped_lm_name}: #{comp.typename} cannot manage forward declared component #{comp.node.scoped_lm_name}"
|
1347
|
+
raise "#{scoped_lm_name}: #{comp.typename} cannot manage forward declared component #{comp.node.scoped_lm_name}"
|
1376
1348
|
end
|
1377
1349
|
@resolved_comp = comp.resolved_type.node
|
1378
1350
|
end
|
1379
1351
|
unless key && key.is_a?(IDL::Type::ScopedName) && key.is_node?(IDL::AST::TemplateParam)
|
1380
1352
|
## TODO : add check for Components::PrimaryKeyBase base type
|
1381
1353
|
unless key.nil? || (key.is_a?(IDL::Type::ScopedName) && key.is_node?(IDL::AST::Valuetype))
|
1382
|
-
raise
|
1383
|
-
"invalid primary key for #{typename} #{scoped_lm_name}: #{key.typename}"
|
1354
|
+
raise "invalid primary key for #{typename} #{scoped_lm_name}: #{key.typename}"
|
1384
1355
|
end
|
1385
1356
|
@resolved_pk = key.resolved_type.node if key
|
1386
1357
|
end
|
@@ -1428,19 +1399,17 @@ module IDL::AST
|
|
1428
1399
|
def is_forward?; false; end
|
1429
1400
|
|
1430
1401
|
def add_interfaces(intfs)
|
1431
|
-
raise
|
1402
|
+
raise "interface support not allowed for #{typename} #{scoped_lm_name}" if intfs && !intfs.empty?
|
1432
1403
|
end
|
1433
1404
|
|
1434
1405
|
def set_base(parent)
|
1435
1406
|
unless parent.is_a?(IDL::Type::ScopedName) && parent.is_node?(IDL::AST::TemplateParam)
|
1436
1407
|
if not (parent.is_a?(IDL::Type::ScopedName) && parent.is_node?(self.class))
|
1437
|
-
raise
|
1438
|
-
"invalid inheritance identifier for #{typename} #{scoped_lm_name}: #{parent.typename}"
|
1408
|
+
raise "invalid inheritance identifier for #{typename} #{scoped_lm_name}: #{parent.typename}"
|
1439
1409
|
end
|
1440
1410
|
@resolved_base = parent.resolved_type.node
|
1441
1411
|
if @resolved_base.has_base?(self)
|
1442
|
-
raise
|
1443
|
-
"circular inheritance detected for #{typename} #{scoped_lm_name}: #{parent.node.scoped_lm_name} is descendant"
|
1412
|
+
raise "circular inheritance detected for #{typename} #{scoped_lm_name}: #{parent.node.scoped_lm_name} is descendant"
|
1444
1413
|
end
|
1445
1414
|
end
|
1446
1415
|
@base = parent.node
|
@@ -1513,17 +1482,14 @@ module IDL::AST
|
|
1513
1482
|
def set_base(parent)
|
1514
1483
|
unless parent.is_a?(IDL::Type::ScopedName) && parent.is_node?(IDL::AST::TemplateParam)
|
1515
1484
|
if not (parent.is_a?(IDL::Type::ScopedName) && parent.is_node?(self.class))
|
1516
|
-
raise
|
1517
|
-
"invalid inheritance identifier for #{typename} #{scoped_lm_name}: #{parent.typename}"
|
1485
|
+
raise "invalid inheritance identifier for #{typename} #{scoped_lm_name}: #{parent.typename}"
|
1518
1486
|
end
|
1519
1487
|
@resolved_base = parent.resolved_type.node
|
1520
1488
|
if not @resolved_base.is_defined?
|
1521
|
-
raise
|
1522
|
-
"#{typename} #{scoped_lm_name} cannot inherit from forward declared #{parent.node.typename} #{parent.node.scoped_lm_name}"
|
1489
|
+
raise "#{typename} #{scoped_lm_name} cannot inherit from forward declared #{parent.node.typename} #{parent.node.scoped_lm_name}"
|
1523
1490
|
end
|
1524
1491
|
if @resolved_base.has_base?(self)
|
1525
|
-
raise
|
1526
|
-
"circular inheritance detected for #{typename} #{scoped_lm_name}: #{parent.node.scoped_lm_name} is descendant"
|
1492
|
+
raise "circular inheritance detected for #{typename} #{scoped_lm_name}: #{parent.node.scoped_lm_name} is descendant"
|
1527
1493
|
end
|
1528
1494
|
end
|
1529
1495
|
@base = parent.node
|
@@ -1603,20 +1569,20 @@ module IDL::AST
|
|
1603
1569
|
super(_name, _enclosure)
|
1604
1570
|
@idltype = params[:type]
|
1605
1571
|
@porttype = params[:porttype]
|
1606
|
-
raise
|
1572
|
+
raise "unknown porttype for #{typename} #{scoped_lm_name}: #{@porttype}" unless PORTTYPES.include?(@porttype)
|
1607
1573
|
case @porttype
|
1608
1574
|
when :facet, :receptacle
|
1609
1575
|
unless @idltype.is_a?(IDL::Type::Object) ||
|
1610
1576
|
(@idltype.is_a?(IDL::Type::ScopedName) && (@idltype.is_node?(IDL::AST::Interface) || @idltype.is_node?(IDL::AST::TemplateParam)))
|
1611
|
-
raise
|
1577
|
+
raise "invalid type for #{typename} #{scoped_lm_name}: #{@idltype.typename}"
|
1612
1578
|
end
|
1613
1579
|
when :port, :mirrorport
|
1614
1580
|
unless @idltype.is_a?(IDL::Type::ScopedName) && (@idltype.is_node?(IDL::AST::Porttype) || @idltype.is_node?(IDL::AST::TemplateParam))
|
1615
|
-
raise
|
1581
|
+
raise "invalid type for #{typename} #{scoped_lm_name}: #{@idltype.typename}"
|
1616
1582
|
end
|
1617
1583
|
else
|
1618
1584
|
unless @idltype.is_a?(IDL::Type::ScopedName) && (@idltype.is_node?(IDL::AST::Eventtype) || @idltype.is_node?(IDL::AST::TemplateParam))
|
1619
|
-
raise
|
1585
|
+
raise "invalid type for #{typename} #{scoped_lm_name}: #{@idltype.typename}"
|
1620
1586
|
end
|
1621
1587
|
end
|
1622
1588
|
@multiple = params[:multiple] ? true : false
|
@@ -1681,8 +1647,7 @@ module IDL::AST
|
|
1681
1647
|
@boxed_type = params[:type]
|
1682
1648
|
unless @boxed_type.is_a?(IDL::Type::ScopedName) && @boxed_type.is_node?(IDL::AST::TemplateParam)
|
1683
1649
|
if @boxed_type.resolved_type.is_a?(IDL::Type::Valuetype)
|
1684
|
-
raise
|
1685
|
-
"boxing valuetype #{@boxed_type.scoped_lm_name} in Valuebox #{scoped_lm_name} not allowed"
|
1650
|
+
raise "boxing valuetype #{@boxed_type.scoped_lm_name} in Valuebox #{scoped_lm_name} not allowed"
|
1686
1651
|
end
|
1687
1652
|
end
|
1688
1653
|
end
|
@@ -1737,8 +1702,7 @@ module IDL::AST
|
|
1737
1702
|
_base = _inherits[:base] || {}
|
1738
1703
|
@truncatable = _base[:truncatable] || false
|
1739
1704
|
if @custom && @truncatable
|
1740
|
-
raise
|
1741
|
-
"'truncatable' attribute *not* allowed for 'custom' #{typename} #{scoped_lm_name}"
|
1705
|
+
raise "'truncatable' attribute *not* allowed for 'custom' #{typename} #{scoped_lm_name}"
|
1742
1706
|
end
|
1743
1707
|
add_bases(_base[:list] || [])
|
1744
1708
|
add_interfaces(_inherits[:supports] || [])
|
@@ -1838,33 +1802,26 @@ module IDL::AST
|
|
1838
1802
|
inherits_.each do |tc|
|
1839
1803
|
unless tc.is_a?(IDL::Type::ScopedName) && tc.is_node?(IDL::AST::TemplateParam)
|
1840
1804
|
if not (tc.is_a?(IDL::Type::ScopedName) && tc.is_node?(IDL::AST::Valuetype))
|
1841
|
-
raise
|
1842
|
-
"invalid inheritance identifier for #{typename} #{scoped_lm_name}: #{tc.typename}"
|
1805
|
+
raise "invalid inheritance identifier for #{typename} #{scoped_lm_name}: #{tc.typename}"
|
1843
1806
|
end
|
1844
1807
|
rtc = tc.resolved_type
|
1845
1808
|
if rtc.node.has_ancestor?(self)
|
1846
|
-
raise
|
1847
|
-
"circular inheritance detected for #{typename} #{scoped_lm_name}: #{tc.node.scoped_lm_name} is descendant"
|
1809
|
+
raise "circular inheritance detected for #{typename} #{scoped_lm_name}: #{tc.node.scoped_lm_name} is descendant"
|
1848
1810
|
end
|
1849
1811
|
if not rtc.node.is_defined?
|
1850
|
-
raise
|
1851
|
-
"#{typename} #{scoped_lm_name} cannot inherit from forward declared #{tc.node.typename} #{tc.node.scoped_lm_name}"
|
1812
|
+
raise "#{typename} #{scoped_lm_name} cannot inherit from forward declared #{tc.node.typename} #{tc.node.scoped_lm_name}"
|
1852
1813
|
end
|
1853
1814
|
if self.is_abstract? and not rtc.node.is_abstract?
|
1854
|
-
raise
|
1855
|
-
"'abstract' #{typename} #{scoped_lm_name} cannot inherit from non-'abstract' #{tc.node.typename} #{tc.node.scoped_lm_name}"
|
1815
|
+
raise "'abstract' #{typename} #{scoped_lm_name} cannot inherit from non-'abstract' #{tc.node.typename} #{tc.node.scoped_lm_name}"
|
1856
1816
|
end
|
1857
1817
|
if (not self.is_custom?) and rtc.node.is_custom?
|
1858
|
-
raise
|
1859
|
-
"non-'custom' #{typename} #{scoped_lm_name} cannot inherit from 'custom' #{tc.node.typename} #{tc.node.scoped_lm_name}"
|
1818
|
+
raise "non-'custom' #{typename} #{scoped_lm_name} cannot inherit from 'custom' #{tc.node.typename} #{tc.node.scoped_lm_name}"
|
1860
1819
|
end
|
1861
1820
|
if @resolved_bases.include?(rtc.node)
|
1862
|
-
raise
|
1863
|
-
"#{typename} #{scoped_lm_name} cannot inherit from #{tc.node.typename} #{tc.node.scoped_lm_name} multiple times"
|
1821
|
+
raise "#{typename} #{scoped_lm_name} cannot inherit from #{tc.node.typename} #{tc.node.scoped_lm_name} multiple times"
|
1864
1822
|
end
|
1865
1823
|
if (not rtc.node.is_abstract?) and @bases.size > 0
|
1866
|
-
raise
|
1867
|
-
"concrete basevalue #{tc.node.typename} #{tc.node.scoped_lm_name} MUST "+
|
1824
|
+
raise "concrete basevalue #{tc.node.typename} #{tc.node.scoped_lm_name} MUST "+
|
1868
1825
|
"be first and only non-abstract in inheritance list for #{typename} #{scoped_lm_name}"
|
1869
1826
|
end
|
1870
1827
|
@resolved_bases << rtc.node
|
@@ -1877,18 +1834,15 @@ module IDL::AST
|
|
1877
1834
|
iflist_.each do |if_|
|
1878
1835
|
unless if_.is_a?(IDL::Type::ScopedName) && if_.is_node?(IDL::AST::TemplateParam)
|
1879
1836
|
if not (if_.is_a?(IDL::Type::ScopedName) && if_.is_node?(IDL::AST::Interface))
|
1880
|
-
raise
|
1881
|
-
"invalid support identifier for #{typename} #{scoped_lm_name}: #{if_.typename}"
|
1837
|
+
raise "invalid support identifier for #{typename} #{scoped_lm_name}: #{if_.typename}"
|
1882
1838
|
end
|
1883
1839
|
rif_ = if_.resolved_type
|
1884
1840
|
### @@TODO@@ further validation
|
1885
1841
|
if (not rif_.node.is_abstract?) and @interfaces.size > 0
|
1886
|
-
raise
|
1887
|
-
"concrete interface '#{rif_.node.scoped_lm_name}' inheritance not allowed for #{typename} #{scoped_lm_name}. Valuetypes can only inherit (support) a single concrete interface."
|
1842
|
+
raise "concrete interface '#{rif_.node.scoped_lm_name}' inheritance not allowed for #{typename} #{scoped_lm_name}. Valuetypes can only inherit (support) a single concrete interface."
|
1888
1843
|
end
|
1889
1844
|
if (not rif_.node.is_abstract?) && (not is_interface_compatible?(rif_.node))
|
1890
|
-
raise
|
1891
|
-
"#{typename} #{scoped_lm_name} cannot support concrete interface #{rif_.node.scoped_lm_name} because it does not derive from inherited concrete interfaces"
|
1845
|
+
raise "#{typename} #{scoped_lm_name} cannot support concrete interface #{rif_.node.scoped_lm_name} because it does not derive from inherited concrete interfaces"
|
1892
1846
|
end
|
1893
1847
|
@resolved_interfaces << rif_.node
|
1894
1848
|
end
|
@@ -1910,7 +1864,7 @@ module IDL::AST
|
|
1910
1864
|
|
1911
1865
|
def define(_type, _name, *args)
|
1912
1866
|
if self.is_abstract? && [IDL::AST::StateMember, IDL::AST::Initializer].include?(_type)
|
1913
|
-
raise
|
1867
|
+
raise "cannot define statemember #{_name} on abstract #{typename} #{scoped_lm_name}"
|
1914
1868
|
end
|
1915
1869
|
super(_type, _name, *args)
|
1916
1870
|
end
|
@@ -1947,7 +1901,7 @@ module IDL::AST
|
|
1947
1901
|
case node
|
1948
1902
|
when IDL::AST::Struct, IDL::AST::Union
|
1949
1903
|
if node.is_defined?
|
1950
|
-
raise
|
1904
|
+
raise "#{node.typename} \"#{node.name}\" is already defined."
|
1951
1905
|
end
|
1952
1906
|
node.annotations.concat(params[:annotations])
|
1953
1907
|
|
@@ -1966,13 +1920,13 @@ module IDL::AST
|
|
1966
1920
|
|
1967
1921
|
return _new_node
|
1968
1922
|
else
|
1969
|
-
raise
|
1923
|
+
raise "#{node.typename} \"#{node.name}\" is already defined."
|
1970
1924
|
end
|
1971
1925
|
end
|
1972
1926
|
|
1973
1927
|
case node
|
1974
1928
|
when IDL::AST::Operation, IDL::AST::Attribute, IDL::AST::StateMember, IDL::AST::Initializer
|
1975
|
-
raise
|
1929
|
+
raise "#{node.typename} '#{node.scoped_lm_name}' cannot be overridden."
|
1976
1930
|
else
|
1977
1931
|
newnode = node.class.new(node.name, self, params)
|
1978
1932
|
newnode.annotations.concat(params[:annotations])
|
@@ -2023,7 +1977,7 @@ module IDL::AST
|
|
2023
1977
|
@idltype = params[:type]
|
2024
1978
|
@visibility = (params[:visibility] == :public ? :public : :private)
|
2025
1979
|
unless @idltype.is_a?(IDL::Type::ScopedName) && @idltype.is_node?(IDL::AST::TemplateParam)
|
2026
|
-
raise
|
1980
|
+
raise "Anonymous type definitions are not allowed!" if params[:type].is_anonymous?
|
2027
1981
|
## check for use of incomplete types
|
2028
1982
|
if !@idltype.is_complete?
|
2029
1983
|
## verify type is used in sequence
|
@@ -2079,7 +2033,7 @@ module IDL::AST
|
|
2079
2033
|
@has_incomplete_type = true
|
2080
2034
|
return
|
2081
2035
|
end
|
2082
|
-
raise
|
2036
|
+
raise "Incomplete type #{@idltype.typename} not allowed here!"
|
2083
2037
|
end
|
2084
2038
|
end
|
2085
2039
|
end
|
@@ -2137,7 +2091,7 @@ module IDL::AST
|
|
2137
2091
|
exlist.each do |extype|
|
2138
2092
|
unless extype.is_a?(IDL::Type::ScopedName) &&
|
2139
2093
|
(extype.is_node?(IDL::AST::Exception) || extype.is_node?(IDL::AST::TemplateParam) || extype.resolved_type.is_a?(IDL::Type::Native))
|
2140
|
-
raise
|
2094
|
+
raise 'Only IDL Exception types allowed in raises declaration.'
|
2141
2095
|
end
|
2142
2096
|
@raises << extype
|
2143
2097
|
end
|
@@ -2192,9 +2146,8 @@ module IDL::AST
|
|
2192
2146
|
@expression = params[:expression]
|
2193
2147
|
@value = nil
|
2194
2148
|
unless @idltype.is_a?(IDL::Type::ScopedName) && @idltype.is_node?(IDL::AST::TemplateParam)
|
2195
|
-
raise
|
2196
|
-
raise
|
2197
|
-
"Incomplete type #{@idltype.typename} not allowed here!" if !@idltype.is_complete?
|
2149
|
+
raise "Anonymous type definitions are not allowed!" if @idltype.is_anonymous?
|
2150
|
+
raise "Incomplete type #{@idltype.typename} not allowed here!" if !@idltype.is_complete?
|
2198
2151
|
unless @expression.is_a?(IDL::Expression::ScopedName) && @expression.is_node?(IDL::AST::TemplateParam)
|
2199
2152
|
@value = @idltype.narrow(@expression.value)
|
2200
2153
|
end
|
@@ -2239,20 +2192,19 @@ module IDL::AST
|
|
2239
2192
|
@idltype = params[:type]
|
2240
2193
|
@attribute = params[:attribute]
|
2241
2194
|
unless ATTRIBUTE_MAP.has_key?(@attribute)
|
2242
|
-
raise
|
2243
|
-
"invalid attribute for parameter: #{params[:attribute]}"
|
2195
|
+
raise "invalid attribute for parameter: #{params[:attribute]}"
|
2244
2196
|
end
|
2245
2197
|
unless @idltype.is_a?(IDL::Type::ScopedName) && @idltype.is_node?(IDL::AST::TemplateParam)
|
2246
|
-
raise
|
2198
|
+
raise "Anonymous type definitions are not allowed!" if params[:type].is_anonymous?
|
2247
2199
|
if @idltype.is_local?
|
2248
2200
|
if _enclosure.enclosure.is_a?(IDL::AST::Interface) && !_enclosure.enclosure.is_local?
|
2249
|
-
raise
|
2201
|
+
raise "Local type #{@idltype.typename} not allowed for operation on unrestricted interface"
|
2250
2202
|
end
|
2251
2203
|
## IDL_Valuetype: no problem as valuetype operations are local
|
2252
2204
|
end
|
2253
2205
|
if !@idltype.is_complete?
|
2254
2206
|
if _enclosure.enclosure.is_a?(IDL::AST::Interface)
|
2255
|
-
raise
|
2207
|
+
raise "Incomplete type #{@idltype.typename} not allowed here!"
|
2256
2208
|
end
|
2257
2209
|
## IDL_Valuetype: no problem as valuetype operations are local
|
2258
2210
|
end
|
@@ -2297,16 +2249,16 @@ module IDL::AST
|
|
2297
2249
|
@raises = []
|
2298
2250
|
@context = nil
|
2299
2251
|
unless @idltype.is_a?(IDL::Type::ScopedName) && @idltype.is_node?(IDL::AST::TemplateParam)
|
2300
|
-
raise
|
2252
|
+
raise "Anonymous type definitions are not allowed!" if params[:type].is_anonymous?
|
2301
2253
|
if @idltype.is_local?
|
2302
2254
|
if _enclosure.is_a?(IDL::AST::Interface) && !_enclosure.is_local?
|
2303
|
-
raise
|
2255
|
+
raise "Local type #{@idltype.typename} not allowed for operation on unrestricted interface"
|
2304
2256
|
end
|
2305
2257
|
## IDL_Valuetype: no problem as valuetype operations are local
|
2306
2258
|
end
|
2307
2259
|
if !@idltype.is_complete?
|
2308
2260
|
if _enclosure.is_a?(IDL::AST::Interface)
|
2309
|
-
raise
|
2261
|
+
raise "Incomplete type #{@idltype.typename} not allowed here!"
|
2310
2262
|
end
|
2311
2263
|
## IDL_Valuetype: no problem as valuetype operations are local
|
2312
2264
|
end
|
@@ -2342,7 +2294,7 @@ module IDL::AST
|
|
2342
2294
|
exlist.each do |extype|
|
2343
2295
|
unless extype.is_a?(IDL::Type::ScopedName) &&
|
2344
2296
|
(extype.is_node?(IDL::AST::Exception) || extype.is_node?(IDL::AST::TemplateParam) || extype.resolved_type.is_a?(IDL::Type::Native))
|
2345
|
-
raise
|
2297
|
+
raise 'Only IDL Exception or Native types allowed in raises declaration.'
|
2346
2298
|
end
|
2347
2299
|
@raises << extype
|
2348
2300
|
end
|
@@ -2407,16 +2359,16 @@ module IDL::AST
|
|
2407
2359
|
@get_raises = []
|
2408
2360
|
@set_raises = []
|
2409
2361
|
unless @idltype.is_a?(IDL::Type::ScopedName) && @idltype.is_node?(IDL::AST::TemplateParam)
|
2410
|
-
raise
|
2362
|
+
raise "Anonymous type definitions are not allowed!" if @idltype.is_anonymous?
|
2411
2363
|
if @idltype.is_local?
|
2412
2364
|
if _enclosure.is_a?(IDL::AST::Interface) && !_enclosure.is_local?
|
2413
|
-
raise
|
2365
|
+
raise "Local type #{@idltype.typename} not allowed for operation on unrestricted interface"
|
2414
2366
|
end
|
2415
2367
|
## IDL_Valuetype: no problem as valuetype operations are local
|
2416
2368
|
end
|
2417
2369
|
if !@idltype.is_complete?
|
2418
2370
|
if _enclosure.is_a?(IDL::AST::Interface)
|
2419
|
-
raise
|
2371
|
+
raise "Incomplete type #{@idltype.typename} not allowed here!"
|
2420
2372
|
end
|
2421
2373
|
## IDL_Valuetype: no problem as valuetype operations are local
|
2422
2374
|
end
|
@@ -2451,7 +2403,7 @@ module IDL::AST
|
|
2451
2403
|
exlist.each do |extype|
|
2452
2404
|
unless extype.is_a?(IDL::Type::ScopedName) &&
|
2453
2405
|
(extype.is_node?(IDL::AST::Exception) || extype.is_node?(IDL::AST::TemplateParam) || extype.resolved_type.is_a?(IDL::Type::Native))
|
2454
|
-
raise
|
2406
|
+
raise 'Only IDL Exception types allowed in raises declaration.' unless extype.resolved_type.node.is_a?(IDL::AST::Exception)
|
2455
2407
|
end
|
2456
2408
|
@get_raises << extype
|
2457
2409
|
end
|
@@ -2461,7 +2413,7 @@ module IDL::AST
|
|
2461
2413
|
exlist.each do |extype|
|
2462
2414
|
unless extype.is_a?(IDL::Type::ScopedName) &&
|
2463
2415
|
(extype.is_node?(IDL::AST::Exception) || extype.is_node?(IDL::AST::TemplateParam) || extype.resolved_type.is_a?(IDL::Type::Native))
|
2464
|
-
raise
|
2416
|
+
raise 'Only IDL Exception types allowed in raises declaration.' unless extype.resolved_type.node.is_a?(IDL::AST::Exception)
|
2465
2417
|
end
|
2466
2418
|
@set_raises << extype
|
2467
2419
|
end
|
@@ -2567,7 +2519,7 @@ module IDL::AST
|
|
2567
2519
|
super(_name, _enclosure)
|
2568
2520
|
@idltype = params[:type]
|
2569
2521
|
unless @idltype.is_a?(IDL::Type::ScopedName) && @idltype.is_node?(IDL::AST::TemplateParam)
|
2570
|
-
raise
|
2522
|
+
raise "Anonymous type definitions are not allowed!" if @idltype.is_anonymous?
|
2571
2523
|
## check for use of incomplete types
|
2572
2524
|
if !@idltype.is_complete?
|
2573
2525
|
## verify type is used in sequence
|
@@ -2601,7 +2553,7 @@ module IDL::AST
|
|
2601
2553
|
end
|
2602
2554
|
end
|
2603
2555
|
end
|
2604
|
-
raise
|
2556
|
+
raise "Incomplete type #{@idltype.typename} not allowed here!"
|
2605
2557
|
end
|
2606
2558
|
end
|
2607
2559
|
end
|
@@ -2693,16 +2645,14 @@ module IDL::AST
|
|
2693
2645
|
## check union case labels for validity
|
2694
2646
|
m.labels.each { |lbl|
|
2695
2647
|
if lbl == :default
|
2696
|
-
raise
|
2697
|
-
"duplicate case label 'default' for #{typename} #{lm_name}" if default_
|
2648
|
+
raise "duplicate case label 'default' for #{typename} #{lm_name}" if default_
|
2698
2649
|
default_ = true
|
2699
2650
|
else
|
2700
2651
|
# correct type
|
2701
2652
|
lv = @switchtype.resolved_type.narrow(lbl.value)
|
2702
2653
|
# doubles
|
2703
2654
|
if labelvals.include? lv
|
2704
|
-
raise
|
2705
|
-
"duplicate case label #{lv.to_s} for #{typename} #{lm_name}"
|
2655
|
+
raise "duplicate case label #{lv.to_s} for #{typename} #{lm_name}"
|
2706
2656
|
end
|
2707
2657
|
labelvals << lv
|
2708
2658
|
end
|
@@ -2711,8 +2661,7 @@ module IDL::AST
|
|
2711
2661
|
## check if default allowed if defined
|
2712
2662
|
if default_
|
2713
2663
|
if @switchtype.resolved_type.range_length == labelvals.size
|
2714
|
-
raise
|
2715
|
-
"'default' case label superfluous for #{typename} #{lm_name}"
|
2664
|
+
raise "'default' case label superfluous for #{typename} #{lm_name}"
|
2716
2665
|
end
|
2717
2666
|
end
|
2718
2667
|
end
|
@@ -2836,7 +2785,7 @@ module IDL::AST
|
|
2836
2785
|
def instantiate(_context, _enclosure)
|
2837
2786
|
# find already instantiated Enum parent
|
2838
2787
|
_enum = _enclosure.resolve(@enum.name)
|
2839
|
-
raise
|
2788
|
+
raise "Unable to resolve instantiated Enum scope for enumerator #{@enum.name}::#{name} instantiation" unless _enum
|
2840
2789
|
super(_context, _enclosure, { :enum => _enum, :value => @value })
|
2841
2790
|
end
|
2842
2791
|
end # Enumerator
|
data/lib/ridl/options.rb
CHANGED
data/lib/ridl/optparse_ext.rb
CHANGED
@@ -23,8 +23,9 @@ require 'optparse'
|
|
23
23
|
class OptionParser::Switch::RequiredArgument
|
24
24
|
def initialize(pattern = nil, conv = nil,
|
25
25
|
short = nil, long = nil, arg = nil,
|
26
|
-
desc = ([] if short or long), block =
|
27
|
-
|
26
|
+
desc = ([] if short or long), block = nil, &_block)
|
27
|
+
block ||= _block
|
28
|
+
super(pattern, conv, short, long, arg, desc, block)
|
28
29
|
if (@long.nil? || @long.empty?) && (@arg =~ /^(<.*>|[\{].*[\}])((=|\s).*)?/)
|
29
30
|
@multichar_short = true
|
30
31
|
@has_arg = (@arg =~ /^(<.*>|[\{].*[\}])(=|\s).*$/ ? true : false)
|
@@ -162,7 +163,7 @@ module IDL
|
|
162
163
|
|
163
164
|
def define_param_set(id, options = {}, &block)
|
164
165
|
id = id.to_sym
|
165
|
-
raise
|
166
|
+
raise "option parameter set [#{id}] already exists" if @group.sets.has_key?(id)
|
166
167
|
@group.sets[id] = ParamSet.new(options)
|
167
168
|
block.call(ParamSet::Configurator.new(@group.sets[id])) if block_given?
|
168
169
|
end
|
@@ -242,7 +243,7 @@ module IDL
|
|
242
243
|
|
243
244
|
def define_group(id, options = {}, &block)
|
244
245
|
id = id.to_sym
|
245
|
-
raise
|
246
|
+
raise "option group [#{id}] already exists" if @option.groups.has_key?(id)
|
246
247
|
@option.groups[id] = Group.new(id, options)
|
247
248
|
block.call(Group::Configurator.new(@option.groups[id])) if block_given?
|
248
249
|
end
|
@@ -328,7 +329,7 @@ module IDL
|
|
328
329
|
|
329
330
|
def define_switch(switch, options = {}, &block)
|
330
331
|
switch = switch.to_s
|
331
|
-
raise
|
332
|
+
raise "switch types mismatch" if @options.has_key?(switch) && options[:type] && options[:type] != @options[switch].type
|
332
333
|
@options[switch] ||= Option.new(switch, options)
|
333
334
|
block.call(Option::Configurator.new(@options[switch])) if block_given?
|
334
335
|
end
|
@@ -353,4 +354,4 @@ module IDL
|
|
353
354
|
|
354
355
|
end # OptionList
|
355
356
|
|
356
|
-
end # IDL
|
357
|
+
end # IDL
|
data/lib/ridl/runner.rb
CHANGED
@@ -85,7 +85,7 @@ module IDL
|
|
85
85
|
# Production management
|
86
86
|
|
87
87
|
def push_production(id, producer)
|
88
|
-
raise
|
88
|
+
raise "Producer #{id} already queued" if @productionbatch.has_key?(id.to_sym)
|
89
89
|
@productionbatch[id.to_sym] = @productionstack.size
|
90
90
|
@productionstack << [id.to_sym, producer]
|
91
91
|
end
|
@@ -185,7 +185,7 @@ module IDL
|
|
185
185
|
else
|
186
186
|
File.open(_idlfile, 'r')
|
187
187
|
end
|
188
|
-
raise
|
188
|
+
raise 'cannot read from STDOUT' if $stdout == _fio
|
189
189
|
|
190
190
|
# parse IDL source
|
191
191
|
IDL.log(1, "RIDL - parsing #{IO === _idlfile ? 'from STDIN': (StringIO === _idlfile ? 'from string' : _idlfile)}")
|
data/lib/ridl/scanner.rb
CHANGED
@@ -517,9 +517,8 @@ module IDL
|
|
517
517
|
else
|
518
518
|
if s2[0] == ?_
|
519
519
|
s2.slice!(0) ## if starts with CORBA IDL escape => remove
|
520
|
-
else
|
521
|
-
parse_error "identifier must begin with alphabet character: #{s2}" unless ALPHA_LC.include?(s2[0]) || ALPHA_UC.include?(s2[0])
|
522
520
|
end
|
521
|
+
parse_error "identifier must begin with alphabet character: #{s2}" unless ALPHA_LC.include?(s2[0]) || ALPHA_UC.include?(s2[0])
|
523
522
|
end
|
524
523
|
|
525
524
|
# preprocessor check
|
data/lib/ridl/type.rb
CHANGED
@@ -15,7 +15,7 @@ module IDL
|
|
15
15
|
self.class.name
|
16
16
|
end
|
17
17
|
def typeerror(val)
|
18
|
-
raise
|
18
|
+
raise "#{val.inspect} cannot narrow to #{self.typename}"
|
19
19
|
end
|
20
20
|
def narrow(obj)
|
21
21
|
obj
|
@@ -51,7 +51,7 @@ module IDL
|
|
51
51
|
|
52
52
|
class UndefinedType
|
53
53
|
def initialize(*args)
|
54
|
-
raise
|
54
|
+
raise "#{self.class.name}'s not implemented yet."
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
@@ -222,7 +222,7 @@ module IDL
|
|
222
222
|
class Fixed < Type
|
223
223
|
attr_reader :digits, :scale
|
224
224
|
def initialize(digits=nil, scale=nil)
|
225
|
-
raise
|
225
|
+
raise "significant digits for Fixed should be in the range 0-31" unless digits.nil? || (0..31) === digits.to_i
|
226
226
|
@digits = digits.nil? ? digits : digits.to_i
|
227
227
|
@scale = scale.nil? ? scale : scale.to_i
|
228
228
|
end
|
@@ -277,7 +277,7 @@ module IDL
|
|
277
277
|
attr_accessor :recursive
|
278
278
|
def length; @size; end
|
279
279
|
def initialize(t, size)
|
280
|
-
raise
|
280
|
+
raise "Anonymous type definitions are not allowed!" if t.is_anonymous?
|
281
281
|
@basetype = t
|
282
282
|
@size = size
|
283
283
|
@typename = format("sequence<%s%s>", t.typename,
|
@@ -321,7 +321,7 @@ module IDL
|
|
321
321
|
attr_reader :basetype
|
322
322
|
attr_reader :sizes
|
323
323
|
def initialize(t, sizes)
|
324
|
-
raise
|
324
|
+
raise "Anonymous type definitions are not allowed!" if t.is_anonymous?
|
325
325
|
@basetype = t
|
326
326
|
if sizes.nil?
|
327
327
|
@sizes = []
|
data/lib/ridl/version.rb
CHANGED
@@ -12,9 +12,9 @@
|
|
12
12
|
|
13
13
|
module IDL
|
14
14
|
|
15
|
-
RIDL_VERSION_MAJOR = 2
|
16
|
-
RIDL_VERSION_MINOR = 7
|
17
|
-
RIDL_VERSION_RELEASE =
|
15
|
+
RIDL_VERSION_MAJOR = 2
|
16
|
+
RIDL_VERSION_MINOR = 7
|
17
|
+
RIDL_VERSION_RELEASE = 1
|
18
18
|
RIDL_VERSION = "#{RIDL_VERSION_MAJOR}.#{RIDL_VERSION_MINOR}.#{RIDL_VERSION_RELEASE}"
|
19
19
|
RIDL_COPYRIGHT = "Copyright (c) 2007-#{Time.now.year} Remedy IT Expertise BV, The Netherlands".freeze
|
20
20
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ridl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.7.
|
4
|
+
version: 2.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Corino
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2020-02-06 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: OMG v3.3 compliant native Ruby IDL compiler frontend with support for
|
15
15
|
pluggable (and stackable) backends.
|
@@ -41,7 +41,9 @@ files:
|
|
41
41
|
homepage: https://www.remedy.nl/opensource/ridl.html
|
42
42
|
licenses:
|
43
43
|
- MIT
|
44
|
-
metadata:
|
44
|
+
metadata:
|
45
|
+
bug_tracker_uri: https://github.com/RemedyIT/ridl/issues
|
46
|
+
source_code_uri: https://github.com/RemedyIT/ridl
|
45
47
|
post_install_message:
|
46
48
|
rdoc_options:
|
47
49
|
- "--main"
|
@@ -54,7 +56,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
54
56
|
requirements:
|
55
57
|
- - ">="
|
56
58
|
- !ruby/object:Gem::Version
|
57
|
-
version: '0'
|
59
|
+
version: '2.0'
|
58
60
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
61
|
requirements:
|
60
62
|
- - ">="
|