ridl 2.7.1 → 2.8.0
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 +1 -1
- data/lib/ridl/delegate.rb +62 -66
- data/lib/ridl/expression.rb +5 -5
- data/lib/ridl/node.rb +172 -212
- data/lib/ridl/parser.rb +1500 -1307
- data/lib/ridl/parser.ry +1 -3
- data/lib/ridl/runner.rb +82 -50
- data/lib/ridl/type.rb +20 -15
- data/lib/ridl/version.rb +2 -2
- metadata +3 -3
data/lib/ridl/parser.ry
CHANGED
@@ -122,9 +122,7 @@ rule
|
|
122
122
|
| template_module_inst_parameters "," template_module_inst_parameter
|
123
123
|
{ val[0] << val[2]; val[0] }
|
124
124
|
|
125
|
-
template_module_inst_parameter :
|
126
|
-
{ val[0] }
|
127
|
-
| template_type_spec
|
125
|
+
template_module_inst_parameter : simple_type_spec
|
128
126
|
{ val[0] }
|
129
127
|
| const_exp
|
130
128
|
{ val[0] }
|
data/lib/ridl/runner.rb
CHANGED
@@ -19,11 +19,6 @@ require 'ridl/options'
|
|
19
19
|
|
20
20
|
module IDL
|
21
21
|
|
22
|
-
# TODO : LEGACY solution for R2CORBA; to be removed when R2CORBA has been updated
|
23
|
-
# See also IDL#init
|
24
|
-
@@embedded = false unless class_variable_defined?(:@@embedded)
|
25
|
-
@@be_name = nil unless class_variable_defined?(:@@be_name)
|
26
|
-
|
27
22
|
OPTIONS = Options.new({
|
28
23
|
:outputdir => nil,
|
29
24
|
:includepaths => [],
|
@@ -39,6 +34,55 @@ module IDL
|
|
39
34
|
CORE_OPTIONS = OPTIONS.keys
|
40
35
|
|
41
36
|
class Engine
|
37
|
+
|
38
|
+
class ProductionStack
|
39
|
+
def initialize
|
40
|
+
@stack = []
|
41
|
+
@index = {}
|
42
|
+
end
|
43
|
+
|
44
|
+
def size
|
45
|
+
@stack.size
|
46
|
+
end
|
47
|
+
|
48
|
+
def empty?
|
49
|
+
@stack.empty?
|
50
|
+
end
|
51
|
+
|
52
|
+
def push(id, prod)
|
53
|
+
@index[id.to_sym] = @stack.size
|
54
|
+
@stack << [id.to_sym, prod]
|
55
|
+
end
|
56
|
+
|
57
|
+
def pop
|
58
|
+
return nil if empty?
|
59
|
+
id, prod = @stack.shift
|
60
|
+
@index.delete(id)
|
61
|
+
prod
|
62
|
+
end
|
63
|
+
|
64
|
+
def peek
|
65
|
+
return nil if empty?
|
66
|
+
id, _ = @stack.first
|
67
|
+
id
|
68
|
+
end
|
69
|
+
|
70
|
+
def remove(id)
|
71
|
+
return nil unless has?(id)
|
72
|
+
i = @index.delete(id.to_sym)
|
73
|
+
_, producer = @productionstack.delete(i)
|
74
|
+
producer
|
75
|
+
end
|
76
|
+
|
77
|
+
def has?(id)
|
78
|
+
@index.has_key?(id.to_sym)
|
79
|
+
end
|
80
|
+
|
81
|
+
def [](id)
|
82
|
+
@stack[@index[id.to_sym]].last
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
42
86
|
def initialize(backend, options)
|
43
87
|
@backend = backend ? Backend.load(backend) : Backend.null_be
|
44
88
|
@initopts = options.merge({
|
@@ -51,8 +95,7 @@ module IDL
|
|
51
95
|
})
|
52
96
|
@optparser = init_optparser
|
53
97
|
@inputstack = []
|
54
|
-
@
|
55
|
-
@productionstack = []
|
98
|
+
@productionstack = ProductionStack.new
|
56
99
|
@options = nil
|
57
100
|
end
|
58
101
|
|
@@ -85,29 +128,20 @@ module IDL
|
|
85
128
|
# Production management
|
86
129
|
|
87
130
|
def push_production(id, producer)
|
88
|
-
raise "Producer #{id} already queued" if @
|
89
|
-
@
|
90
|
-
@productionstack << [id.to_sym, producer]
|
131
|
+
raise "Producer #{id} already queued" if @productionstack.has?(id)
|
132
|
+
@productionstack.push(id, producer)
|
91
133
|
end
|
92
134
|
|
93
135
|
def pop_production
|
94
|
-
|
95
|
-
id, producer = @productionstack.shift
|
96
|
-
@productionbatch.delete(id)
|
97
|
-
producer
|
136
|
+
@productionstack.pop
|
98
137
|
end
|
99
138
|
|
100
139
|
def peek_production
|
101
|
-
|
102
|
-
id, _ = @productionstack.first
|
103
|
-
id
|
140
|
+
@productionstack.peek
|
104
141
|
end
|
105
142
|
|
106
143
|
def remove_production(id)
|
107
|
-
|
108
|
-
i = @productionbatch.delete(id.to_sym)
|
109
|
-
_, producer = @productionstack.delete(i)
|
110
|
-
producer
|
144
|
+
@productionstack.remove(id)
|
111
145
|
end
|
112
146
|
|
113
147
|
def has_productions?
|
@@ -115,11 +149,11 @@ module IDL
|
|
115
149
|
end
|
116
150
|
|
117
151
|
def has_production?(id)
|
118
|
-
@
|
152
|
+
@productionstack.has?(id)
|
119
153
|
end
|
120
154
|
|
121
155
|
def production(id)
|
122
|
-
@productionstack[
|
156
|
+
@productionstack[id]
|
123
157
|
end
|
124
158
|
|
125
159
|
# Verbosity control
|
@@ -452,39 +486,37 @@ module IDL
|
|
452
486
|
def IDL.init(argv = ARGV)
|
453
487
|
options = OPTIONS.dup
|
454
488
|
|
455
|
-
|
456
|
-
|
457
|
-
Options.load_config(options)
|
489
|
+
# load config file(s) if any
|
490
|
+
Options.load_config(options)
|
458
491
|
|
459
|
-
|
492
|
+
IDL.log(2, "Configuration [#{options}]")
|
460
493
|
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
494
|
+
# check commandline args for explicit language mapping backend
|
495
|
+
if argv.first =~ /^:\S+/
|
496
|
+
be_name = argv.shift.reverse.chop.reverse.to_sym
|
497
|
+
elsif ENV['RIDL_BE_SELECT'] # or from environment
|
498
|
+
be_name = ENV['RIDL_BE_SELECT'].to_sym
|
499
|
+
elsif options[:backend] # or from configuration
|
500
|
+
be_name = options[:backend].to_sym
|
501
|
+
end
|
469
502
|
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
end
|
503
|
+
# add optional search paths for RIDL backends
|
504
|
+
options[:be_path] ||= []
|
505
|
+
options[:be_path].unshift(*ENV['RIDL_BE_PATH'].split(/#{File::PATH_SEPARATOR}/)) if ENV['RIDL_BE_PATH']
|
506
|
+
options[:be_path].collect! {|p| p.gsub('\\', '/') } # cleanup to prevent mixed path separators
|
507
|
+
$:.concat(options[:be_path]) unless options[:be_path].empty?
|
508
|
+
|
509
|
+
# check for special bootstrapping switches
|
510
|
+
if argv.first == '--preprocess'
|
511
|
+
options[:preprocess] = true
|
512
|
+
argv.shift
|
513
|
+
elsif argv.first == '--ignore-pidl'
|
514
|
+
options[:ignore_pidl] = true
|
515
|
+
argv.shift
|
484
516
|
end
|
485
517
|
|
486
518
|
# create RIDL engine
|
487
|
-
Thread.current[:ridl_engine] = Engine.new(
|
519
|
+
Thread.current[:ridl_engine] = Engine.new(be_name, options)
|
488
520
|
end
|
489
521
|
|
490
522
|
# main run method
|
data/lib/ridl/type.rb
CHANGED
@@ -45,7 +45,7 @@ module IDL
|
|
45
45
|
self.class == idltype.class
|
46
46
|
end
|
47
47
|
|
48
|
-
def instantiate(
|
48
|
+
def instantiate(_)
|
49
49
|
self
|
50
50
|
end
|
51
51
|
|
@@ -65,6 +65,7 @@ module IDL
|
|
65
65
|
class NodeType < Type
|
66
66
|
attr_reader :node
|
67
67
|
def initialize(node)
|
68
|
+
raise node.inspect if node && !node.is_a?(IDL::AST::Leaf)
|
68
69
|
@node = node
|
69
70
|
end
|
70
71
|
def is_local?(recurstk = nil)
|
@@ -106,9 +107,9 @@ module IDL
|
|
106
107
|
def is_template?
|
107
108
|
@node.is_template?
|
108
109
|
end
|
109
|
-
def instantiate(
|
110
|
+
def instantiate(instantiation_context)
|
110
111
|
if self.is_template?
|
111
|
-
cp = IDL::AST::TemplateParam.concrete_param(
|
112
|
+
cp = IDL::AST::TemplateParam.concrete_param(instantiation_context, @node)
|
112
113
|
cp.is_a?(Type) ? cp : ScopedName.new(cp)
|
113
114
|
else
|
114
115
|
self
|
@@ -236,8 +237,8 @@ module IDL
|
|
236
237
|
def is_template?
|
237
238
|
(@size && @size.is_a?(IDL::Expression) && @size.is_template?)
|
238
239
|
end
|
239
|
-
def instantiate(
|
240
|
-
self.is_template? ? (Type::Fixed.new(@size.instantiate(
|
240
|
+
def instantiate(instantiation_context)
|
241
|
+
self.is_template? ? (Type::Fixed.new(@size.instantiate(instantiation_context).value)) : self
|
241
242
|
end
|
242
243
|
end
|
243
244
|
|
@@ -267,8 +268,8 @@ module IDL
|
|
267
268
|
def matches?(idltype)
|
268
269
|
super && self.size == idltype.size
|
269
270
|
end
|
270
|
-
def instantiate(
|
271
|
-
self.is_template? ? (Type::String.new(@size.instantiate(
|
271
|
+
def instantiate(instantiation_context)
|
272
|
+
self.is_template? ? (Type::String.new(@size.instantiate(instantiation_context).value)) : self
|
272
273
|
end
|
273
274
|
end
|
274
275
|
|
@@ -312,8 +313,12 @@ module IDL
|
|
312
313
|
def matches?(idltype)
|
313
314
|
super && self.size == idltype.size && self.basetype.resolved_type.matches?(idltype.basetype.resolved_type)
|
314
315
|
end
|
315
|
-
def instantiate(
|
316
|
-
self.is_template?
|
316
|
+
def instantiate(instantiation_context)
|
317
|
+
if self.is_template?
|
318
|
+
Type::Sequence.new(@basetype.instantiate(instantiation_context), @size ? @size.instantiate(instantiation_context).value : nil)
|
319
|
+
else
|
320
|
+
self
|
321
|
+
end
|
317
322
|
end
|
318
323
|
end
|
319
324
|
|
@@ -352,8 +357,8 @@ module IDL
|
|
352
357
|
def matches?(idltype)
|
353
358
|
super && self.sizes == idltype.sizes && self.basetype.resolved_type.matches?(idltype.basetype.resolved_type)
|
354
359
|
end
|
355
|
-
def instantiate(
|
356
|
-
self.is_template? ? Type::Array.new(@basetype.instantiate(
|
360
|
+
def instantiate(instantiation_context)
|
361
|
+
self.is_template? ? Type::Array.new(@basetype.instantiate(instantiation_context), @sizes.collect { |sz| sz.instantiate(instantiation_context).value }) : self
|
357
362
|
end
|
358
363
|
end
|
359
364
|
|
@@ -383,8 +388,8 @@ module IDL
|
|
383
388
|
def matches?(idltype)
|
384
389
|
super && self.size == idltype.size
|
385
390
|
end
|
386
|
-
def instantiate(
|
387
|
-
self.is_template? ? Type::WString.new(@size.instantiate(
|
391
|
+
def instantiate(instantiation_context)
|
392
|
+
self.is_template? ? Type::WString.new(@size.instantiate(instantiation_context).value) : self
|
388
393
|
end
|
389
394
|
end
|
390
395
|
|
@@ -509,8 +514,8 @@ module IDL
|
|
509
514
|
def is_template?
|
510
515
|
@type.is_template?
|
511
516
|
end
|
512
|
-
def instantiate(
|
513
|
-
self.is_template? ? Type::Const.new(@type.instantiate(
|
517
|
+
def instantiate(instantiation_context)
|
518
|
+
self.is_template? ? Type::Const.new(@type.instantiate(instantiation_context)) : self
|
514
519
|
end
|
515
520
|
def is_node?(node_class)
|
516
521
|
@type.is_node?(node_class)
|
data/lib/ridl/version.rb
CHANGED
@@ -13,8 +13,8 @@
|
|
13
13
|
module IDL
|
14
14
|
|
15
15
|
RIDL_VERSION_MAJOR = 2
|
16
|
-
RIDL_VERSION_MINOR =
|
17
|
-
RIDL_VERSION_RELEASE =
|
16
|
+
RIDL_VERSION_MINOR = 8
|
17
|
+
RIDL_VERSION_RELEASE = 0
|
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.
|
4
|
+
version: 2.8.0
|
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: 2020-
|
12
|
+
date: 2020-10-07 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.
|
@@ -63,7 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
63
63
|
- !ruby/object:Gem::Version
|
64
64
|
version: '0'
|
65
65
|
requirements: []
|
66
|
-
rubygems_version: 3.
|
66
|
+
rubygems_version: 3.1.4
|
67
67
|
signing_key:
|
68
68
|
specification_version: 4
|
69
69
|
summary: Ruby OMG IDL compiler
|