ridl 2.8.1 → 2.9.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 +9 -3
 - data/lib/ridl/backend.rb +11 -12
 - data/lib/ridl/delegate.rb +89 -59
 - data/lib/ridl/expression.rb +65 -27
 - data/lib/ridl/genfile.rb +22 -16
 - data/lib/ridl/node.rb +328 -189
 - data/lib/ridl/options.rb +9 -11
 - data/lib/ridl/optparse_ext.rb +32 -34
 - data/lib/ridl/parser.rb +456 -236
 - data/lib/ridl/runner.rb +33 -26
 - data/lib/ridl/scanner.rb +171 -141
 - data/lib/ridl/type.rb +113 -13
 - data/lib/ridl/version.rb +2 -4
 - metadata +4 -4
 
    
        data/lib/ridl/type.rb
    CHANGED
    
    | 
         @@ -14,33 +14,43 @@ module IDL 
     | 
|
| 
       14 
14 
     | 
    
         
             
                def typename
         
     | 
| 
       15 
15 
     | 
    
         
             
                  self.class.name
         
     | 
| 
       16 
16 
     | 
    
         
             
                end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
       17 
18 
     | 
    
         
             
                def typeerror(val)
         
     | 
| 
       18 
19 
     | 
    
         
             
                  raise "#{val.inspect} cannot narrow to #{self.typename}"
         
     | 
| 
       19 
20 
     | 
    
         
             
                end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
       20 
22 
     | 
    
         
             
                def narrow(obj)
         
     | 
| 
       21 
23 
     | 
    
         
             
                  obj
         
     | 
| 
       22 
24 
     | 
    
         
             
                end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
       23 
26 
     | 
    
         
             
                def resolved_type
         
     | 
| 
       24 
27 
     | 
    
         
             
                  self
         
     | 
| 
       25 
28 
     | 
    
         
             
                end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
       26 
30 
     | 
    
         
             
                def is_complete?
         
     | 
| 
       27 
31 
     | 
    
         
             
                  true
         
     | 
| 
       28 
32 
     | 
    
         
             
                end
         
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
                def is_local?(_recurstk = nil)
         
     | 
| 
       30 
35 
     | 
    
         
             
                  false
         
     | 
| 
       31 
36 
     | 
    
         
             
                end
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
       32 
38 
     | 
    
         
             
                def is_anonymous?
         
     | 
| 
       33 
39 
     | 
    
         
             
                  false
         
     | 
| 
       34 
40 
     | 
    
         
             
                end
         
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
                def is_node?(_node_class)
         
     | 
| 
       36 
43 
     | 
    
         
             
                  false
         
     | 
| 
       37 
44 
     | 
    
         
             
                end
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
       38 
46 
     | 
    
         
             
                def resolved_node
         
     | 
| 
       39 
47 
     | 
    
         
             
                  nil
         
     | 
| 
       40 
48 
     | 
    
         
             
                end
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
       41 
50 
     | 
    
         
             
                def is_template?
         
     | 
| 
       42 
51 
     | 
    
         
             
                  false
         
     | 
| 
       43 
52 
     | 
    
         
             
                end
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
       44 
54 
     | 
    
         
             
                def matches?(idltype)
         
     | 
| 
       45 
55 
     | 
    
         
             
                  self.class == idltype.class
         
     | 
| 
       46 
56 
     | 
    
         
             
                end
         
     | 
| 
         @@ -50,7 +60,7 @@ module IDL 
     | 
|
| 
       50 
60 
     | 
    
         
             
                end
         
     | 
| 
       51 
61 
     | 
    
         | 
| 
       52 
62 
     | 
    
         
             
                class UndefinedType
         
     | 
| 
       53 
     | 
    
         
            -
                  def initialize(* 
     | 
| 
      
 63 
     | 
    
         
            +
                  def initialize(*_args)
         
     | 
| 
       54 
64 
     | 
    
         
             
                    raise "#{self.class.name}'s not implemented yet."
         
     | 
| 
       55 
65 
     | 
    
         
             
                  end
         
     | 
| 
       56 
66 
     | 
    
         
             
                end
         
     | 
| 
         @@ -64,19 +74,25 @@ module IDL 
     | 
|
| 
       64 
74 
     | 
    
         | 
| 
       65 
75 
     | 
    
         
             
                class NodeType < Type
         
     | 
| 
       66 
76 
     | 
    
         
             
                  attr_reader :node
         
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
       67 
78 
     | 
    
         
             
                  def initialize(node)
         
     | 
| 
       68 
79 
     | 
    
         
             
                    raise node.inspect if node && !node.is_a?(IDL::AST::Leaf)
         
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
       69 
81 
     | 
    
         
             
                    @node = node
         
     | 
| 
       70 
82 
     | 
    
         
             
                  end
         
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
      
 83 
     | 
    
         
            +
             
     | 
| 
      
 84 
     | 
    
         
            +
                  def is_local?(_recurstk = nil)
         
     | 
| 
       72 
85 
     | 
    
         
             
                    @node.is_local?
         
     | 
| 
       73 
86 
     | 
    
         
             
                  end
         
     | 
| 
      
 87 
     | 
    
         
            +
             
     | 
| 
       74 
88 
     | 
    
         
             
                  def is_node?(node_class)
         
     | 
| 
       75 
89 
     | 
    
         
             
                    @node.is_a?(node_class)
         
     | 
| 
       76 
90 
     | 
    
         
             
                  end
         
     | 
| 
      
 91 
     | 
    
         
            +
             
     | 
| 
       77 
92 
     | 
    
         
             
                  def resolved_node
         
     | 
| 
       78 
93 
     | 
    
         
             
                    @node
         
     | 
| 
       79 
94 
     | 
    
         
             
                  end
         
     | 
| 
      
 95 
     | 
    
         
            +
             
     | 
| 
       80 
96 
     | 
    
         
             
                  def matches?(idltype)
         
     | 
| 
       81 
97 
     | 
    
         
             
                    super && self.resolved_node == idltype.resolved_node
         
     | 
| 
       82 
98 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -86,27 +102,35 @@ module IDL 
     | 
|
| 
       86 
102 
     | 
    
         
             
                  def typename
         
     | 
| 
       87 
103 
     | 
    
         
             
                    @node.name
         
     | 
| 
       88 
104 
     | 
    
         
             
                  end
         
     | 
| 
      
 105 
     | 
    
         
            +
             
     | 
| 
       89 
106 
     | 
    
         
             
                  def narrow(obj)
         
     | 
| 
       90 
107 
     | 
    
         
             
                    @node.idltype.narrow(obj)
         
     | 
| 
       91 
108 
     | 
    
         
             
                  end
         
     | 
| 
      
 109 
     | 
    
         
            +
             
     | 
| 
       92 
110 
     | 
    
         
             
                  def resolved_type
         
     | 
| 
       93 
111 
     | 
    
         
             
                    @node.idltype.resolved_type
         
     | 
| 
       94 
112 
     | 
    
         
             
                  end
         
     | 
| 
      
 113 
     | 
    
         
            +
             
     | 
| 
       95 
114 
     | 
    
         
             
                  def is_complete?
         
     | 
| 
       96 
115 
     | 
    
         
             
                    resolved_type.is_complete?
         
     | 
| 
       97 
116 
     | 
    
         
             
                  end
         
     | 
| 
      
 117 
     | 
    
         
            +
             
     | 
| 
       98 
118 
     | 
    
         
             
                  def is_local?(recurstk = [])
         
     | 
| 
       99 
119 
     | 
    
         
             
                    resolved_type.is_local?(recurstk)
         
     | 
| 
       100 
120 
     | 
    
         
             
                  end
         
     | 
| 
      
 121 
     | 
    
         
            +
             
     | 
| 
       101 
122 
     | 
    
         
             
                  def is_node?(node_class)
         
     | 
| 
       102 
123 
     | 
    
         
             
                    @node.is_a?(IDL::AST::Typedef) ? @node.idltype.is_node?(node_class) : @node.is_a?(node_class)
         
     | 
| 
       103 
124 
     | 
    
         
             
                  end
         
     | 
| 
      
 125 
     | 
    
         
            +
             
     | 
| 
       104 
126 
     | 
    
         
             
                  def resolved_node
         
     | 
| 
       105 
127 
     | 
    
         
             
                    @node.is_a?(IDL::AST::Typedef) ? @node.idltype.resolved_node : @node
         
     | 
| 
       106 
128 
     | 
    
         
             
                  end
         
     | 
| 
      
 129 
     | 
    
         
            +
             
     | 
| 
       107 
130 
     | 
    
         
             
                  def is_template?
         
     | 
| 
       108 
131 
     | 
    
         
             
                    @node.is_template?
         
     | 
| 
       109 
132 
     | 
    
         
             
                  end
         
     | 
| 
      
 133 
     | 
    
         
            +
             
     | 
| 
       110 
134 
     | 
    
         
             
                  def instantiate(instantiation_context)
         
     | 
| 
       111 
135 
     | 
    
         
             
                    if self.is_template?
         
     | 
| 
       112 
136 
     | 
    
         
             
                      cp = IDL::AST::TemplateParam.concrete_param(instantiation_context, @node)
         
     | 
| 
         @@ -125,7 +149,7 @@ module IDL 
     | 
|
| 
       125 
149 
     | 
    
         
             
                  end
         
     | 
| 
       126 
150 
     | 
    
         | 
| 
       127 
151 
     | 
    
         
             
                  def self.is_unsigned?
         
     | 
| 
       128 
     | 
    
         
            -
                    self::Range.first 
     | 
| 
      
 152 
     | 
    
         
            +
                    self::Range.first.zero?
         
     | 
| 
       129 
153 
     | 
    
         
             
                  end
         
     | 
| 
       130 
154 
     | 
    
         | 
| 
       131 
155 
     | 
    
         
             
                  def self.bits
         
     | 
| 
         @@ -173,37 +197,47 @@ module IDL 
     | 
|
| 
       173 
197 
     | 
    
         
             
                    typeerror(obj) unless [TrueClass, FalseClass].include? obj.class
         
     | 
| 
       174 
198 
     | 
    
         
             
                    obj
         
     | 
| 
       175 
199 
     | 
    
         
             
                  end
         
     | 
| 
      
 200 
     | 
    
         
            +
             
     | 
| 
       176 
201 
     | 
    
         
             
                  def range_length
         
     | 
| 
       177 
202 
     | 
    
         
             
                    2
         
     | 
| 
       178 
203 
     | 
    
         
             
                  end
         
     | 
| 
      
 204 
     | 
    
         
            +
             
     | 
| 
       179 
205 
     | 
    
         
             
                  def min
         
     | 
| 
       180 
206 
     | 
    
         
             
                    false
         
     | 
| 
       181 
207 
     | 
    
         
             
                  end
         
     | 
| 
      
 208 
     | 
    
         
            +
             
     | 
| 
       182 
209 
     | 
    
         
             
                  def max
         
     | 
| 
       183 
210 
     | 
    
         
             
                    true
         
     | 
| 
       184 
211 
     | 
    
         
             
                  end
         
     | 
| 
      
 212 
     | 
    
         
            +
             
     | 
| 
       185 
213 
     | 
    
         
             
                  def in_range?(val)
         
     | 
| 
       186 
214 
     | 
    
         
             
                    Range.include?(val)
         
     | 
| 
       187 
215 
     | 
    
         
             
                  end
         
     | 
| 
      
 216 
     | 
    
         
            +
             
     | 
| 
       188 
217 
     | 
    
         
             
                  def next(val)
         
     | 
| 
       189 
218 
     | 
    
         
             
                    !val
         
     | 
| 
       190 
219 
     | 
    
         
             
                  end
         
     | 
| 
       191 
220 
     | 
    
         
             
                end
         
     | 
| 
      
 221 
     | 
    
         
            +
             
     | 
| 
       192 
222 
     | 
    
         
             
                class Char < Type
         
     | 
| 
       193 
223 
     | 
    
         
             
                  def narrow(obj)
         
     | 
| 
       194 
224 
     | 
    
         
             
                    typeerror(obj) unless ::Integer === obj
         
     | 
| 
       195 
225 
     | 
    
         
             
                    typeerror(obj) unless (0..255) === obj
         
     | 
| 
       196 
226 
     | 
    
         
             
                    obj
         
     | 
| 
       197 
227 
     | 
    
         
             
                  end
         
     | 
| 
      
 228 
     | 
    
         
            +
             
     | 
| 
       198 
229 
     | 
    
         
             
                  def range_length
         
     | 
| 
       199 
230 
     | 
    
         
             
                    256
         
     | 
| 
       200 
231 
     | 
    
         
             
                  end
         
     | 
| 
      
 232 
     | 
    
         
            +
             
     | 
| 
       201 
233 
     | 
    
         
             
                  def min
         
     | 
| 
       202 
234 
     | 
    
         
             
                    0
         
     | 
| 
       203 
235 
     | 
    
         
             
                  end
         
     | 
| 
      
 236 
     | 
    
         
            +
             
     | 
| 
       204 
237 
     | 
    
         
             
                  def in_range?(val)
         
     | 
| 
       205 
238 
     | 
    
         
             
                    val >= self.min && val <= self.max
         
     | 
| 
       206 
239 
     | 
    
         
             
                  end
         
     | 
| 
      
 240 
     | 
    
         
            +
             
     | 
| 
       207 
241 
     | 
    
         
             
                  def max
         
     | 
| 
       208 
242 
     | 
    
         
             
                    255
         
     | 
| 
       209 
243 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -212,31 +246,40 @@ module IDL 
     | 
|
| 
       212 
246 
     | 
    
         
             
                    val < self.max ? val + 1 : self.min
         
     | 
| 
       213 
247 
     | 
    
         
             
                  end
         
     | 
| 
       214 
248 
     | 
    
         
             
                end
         
     | 
| 
      
 249 
     | 
    
         
            +
             
     | 
| 
       215 
250 
     | 
    
         
             
                class Float < Type
         
     | 
| 
       216 
251 
     | 
    
         
             
                  def narrow(obj)
         
     | 
| 
       217 
252 
     | 
    
         
             
                    typeerror(obj) unless ::Float === obj
         
     | 
| 
       218 
253 
     | 
    
         
             
                    obj
         
     | 
| 
       219 
254 
     | 
    
         
             
                  end
         
     | 
| 
       220 
255 
     | 
    
         
             
                end
         
     | 
| 
      
 256 
     | 
    
         
            +
             
     | 
| 
       221 
257 
     | 
    
         
             
                class Double < Float; end
         
     | 
| 
       222 
258 
     | 
    
         
             
                class LongDouble < Float; end
         
     | 
| 
      
 259 
     | 
    
         
            +
             
     | 
| 
       223 
260 
     | 
    
         
             
                class Fixed < Type
         
     | 
| 
       224 
261 
     | 
    
         
             
                  attr_reader :digits, :scale
         
     | 
| 
       225 
     | 
    
         
            -
             
     | 
| 
      
 262 
     | 
    
         
            +
             
     | 
| 
      
 263 
     | 
    
         
            +
                  def initialize(digits = nil, scale = nil)
         
     | 
| 
       226 
264 
     | 
    
         
             
                    raise "significant digits for Fixed should be in the range 0-31" unless digits.nil? || (0..31) === digits.to_i
         
     | 
| 
      
 265 
     | 
    
         
            +
             
     | 
| 
       227 
266 
     | 
    
         
             
                    @digits = digits.nil? ? digits : digits.to_i
         
     | 
| 
       228 
267 
     | 
    
         
             
                    @scale = scale.nil? ? scale : scale.to_i
         
     | 
| 
       229 
268 
     | 
    
         
             
                  end
         
     | 
| 
      
 269 
     | 
    
         
            +
             
     | 
| 
       230 
270 
     | 
    
         
             
                  def narrow(obj)
         
     | 
| 
       231 
     | 
    
         
            -
                    #typeerror(obj)
         
     | 
| 
      
 271 
     | 
    
         
            +
                    # typeerror(obj)
         
     | 
| 
       232 
272 
     | 
    
         
             
                    obj
         
     | 
| 
       233 
273 
     | 
    
         
             
                  end
         
     | 
| 
      
 274 
     | 
    
         
            +
             
     | 
| 
       234 
275 
     | 
    
         
             
                  def is_anonymous?
         
     | 
| 
       235 
276 
     | 
    
         
             
                    false
         
     | 
| 
       236 
277 
     | 
    
         
             
                  end
         
     | 
| 
      
 278 
     | 
    
         
            +
             
     | 
| 
       237 
279 
     | 
    
         
             
                  def is_template?
         
     | 
| 
       238 
280 
     | 
    
         
             
                    (@size && @size.is_a?(IDL::Expression) && @size.is_template?)
         
     | 
| 
       239 
281 
     | 
    
         
             
                  end
         
     | 
| 
      
 282 
     | 
    
         
            +
             
     | 
| 
       240 
283 
     | 
    
         
             
                  def instantiate(instantiation_context)
         
     | 
| 
       241 
284 
     | 
    
         
             
                    self.is_template? ? (Type::Fixed.new(@size.instantiate(instantiation_context).value)) : self
         
     | 
| 
       242 
285 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -244,11 +287,15 @@ module IDL 
     | 
|
| 
       244 
287 
     | 
    
         | 
| 
       245 
288 
     | 
    
         
             
                class String < Type
         
     | 
| 
       246 
289 
     | 
    
         
             
                  attr_reader :size
         
     | 
| 
       247 
     | 
    
         
            -
             
     | 
| 
      
 290 
     | 
    
         
            +
             
     | 
| 
      
 291 
     | 
    
         
            +
                  def length
         
     | 
| 
      
 292 
     | 
    
         
            +
                    @size
         
     | 
| 
      
 293 
     | 
    
         
            +
                  end
         
     | 
| 
       248 
294 
     | 
    
         | 
| 
       249 
295 
     | 
    
         
             
                  def initialize(size = nil)
         
     | 
| 
       250 
296 
     | 
    
         
             
                    @size = size
         
     | 
| 
       251 
297 
     | 
    
         
             
                  end
         
     | 
| 
      
 298 
     | 
    
         
            +
             
     | 
| 
       252 
299 
     | 
    
         
             
                  def narrow(obj)
         
     | 
| 
       253 
300 
     | 
    
         
             
                    typeerror(obj) unless ::String === obj
         
     | 
| 
       254 
301 
     | 
    
         
             
                    if @size.nil?
         
     | 
| 
         @@ -259,15 +306,19 @@ module IDL 
     | 
|
| 
       259 
306 
     | 
    
         
             
                      obj
         
     | 
| 
       260 
307 
     | 
    
         
             
                    end
         
     | 
| 
       261 
308 
     | 
    
         
             
                  end
         
     | 
| 
      
 309 
     | 
    
         
            +
             
     | 
| 
       262 
310 
     | 
    
         
             
                  def is_anonymous?
         
     | 
| 
       263 
311 
     | 
    
         
             
                    @size ? true : false
         
     | 
| 
       264 
312 
     | 
    
         
             
                  end
         
     | 
| 
      
 313 
     | 
    
         
            +
             
     | 
| 
       265 
314 
     | 
    
         
             
                  def is_template?
         
     | 
| 
       266 
315 
     | 
    
         
             
                    (@size && @size.is_a?(IDL::Expression) && @size.is_template?)
         
     | 
| 
       267 
316 
     | 
    
         
             
                  end
         
     | 
| 
      
 317 
     | 
    
         
            +
             
     | 
| 
       268 
318 
     | 
    
         
             
                  def matches?(idltype)
         
     | 
| 
       269 
319 
     | 
    
         
             
                    super && self.size == idltype.size
         
     | 
| 
       270 
320 
     | 
    
         
             
                  end
         
     | 
| 
      
 321 
     | 
    
         
            +
             
     | 
| 
       271 
322 
     | 
    
         
             
                  def instantiate(instantiation_context)
         
     | 
| 
       272 
323 
     | 
    
         
             
                    self.is_template? ? (Type::String.new(@size.instantiate(instantiation_context).value)) : self
         
     | 
| 
       273 
324 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -276,9 +327,14 @@ module IDL 
     | 
|
| 
       276 
327 
     | 
    
         
             
                class Sequence < Type
         
     | 
| 
       277 
328 
     | 
    
         
             
                  attr_reader :size, :basetype
         
     | 
| 
       278 
329 
     | 
    
         
             
                  attr_accessor :recursive
         
     | 
| 
       279 
     | 
    
         
            -
             
     | 
| 
      
 330 
     | 
    
         
            +
             
     | 
| 
      
 331 
     | 
    
         
            +
                  def length
         
     | 
| 
      
 332 
     | 
    
         
            +
                    @size
         
     | 
| 
      
 333 
     | 
    
         
            +
                  end
         
     | 
| 
      
 334 
     | 
    
         
            +
             
     | 
| 
       280 
335 
     | 
    
         
             
                  def initialize(t, size)
         
     | 
| 
       281 
336 
     | 
    
         
             
                    raise "Anonymous type definitions are not allowed!" if t.is_anonymous?
         
     | 
| 
      
 337 
     | 
    
         
            +
             
     | 
| 
       282 
338 
     | 
    
         
             
                    @basetype = t
         
     | 
| 
       283 
339 
     | 
    
         
             
                    @size = size
         
     | 
| 
       284 
340 
     | 
    
         
             
                    @typename = format("sequence<%s%s>", t.typename,
         
     | 
| 
         @@ -289,30 +345,39 @@ module IDL 
     | 
|
| 
       289 
345 
     | 
    
         
             
                                       end)
         
     | 
| 
       290 
346 
     | 
    
         
             
                    @recursive = false
         
     | 
| 
       291 
347 
     | 
    
         
             
                  end
         
     | 
| 
      
 348 
     | 
    
         
            +
             
     | 
| 
       292 
349 
     | 
    
         
             
                  def typename
         
     | 
| 
       293 
350 
     | 
    
         
             
                    @typename
         
     | 
| 
       294 
351 
     | 
    
         
             
                  end
         
     | 
| 
      
 352 
     | 
    
         
            +
             
     | 
| 
       295 
353 
     | 
    
         
             
                  def narrow(obj)
         
     | 
| 
       296 
354 
     | 
    
         
             
                    typeerror(obj)
         
     | 
| 
       297 
355 
     | 
    
         
             
                  end
         
     | 
| 
      
 356 
     | 
    
         
            +
             
     | 
| 
       298 
357 
     | 
    
         
             
                  def is_complete?
         
     | 
| 
       299 
358 
     | 
    
         
             
                    @basetype.resolved_type.is_complete?
         
     | 
| 
       300 
359 
     | 
    
         
             
                  end
         
     | 
| 
      
 360 
     | 
    
         
            +
             
     | 
| 
       301 
361 
     | 
    
         
             
                  def is_local?(recurstk = [])
         
     | 
| 
       302 
362 
     | 
    
         
             
                    @basetype.resolved_type.is_local?(recurstk)
         
     | 
| 
       303 
363 
     | 
    
         
             
                  end
         
     | 
| 
      
 364 
     | 
    
         
            +
             
     | 
| 
       304 
365 
     | 
    
         
             
                  def is_recursive?
         
     | 
| 
       305 
366 
     | 
    
         
             
                    @recursive
         
     | 
| 
       306 
367 
     | 
    
         
             
                  end
         
     | 
| 
      
 368 
     | 
    
         
            +
             
     | 
| 
       307 
369 
     | 
    
         
             
                  def is_anonymous?
         
     | 
| 
       308 
370 
     | 
    
         
             
                    true
         
     | 
| 
       309 
371 
     | 
    
         
             
                  end
         
     | 
| 
      
 372 
     | 
    
         
            +
             
     | 
| 
       310 
373 
     | 
    
         
             
                  def is_template?
         
     | 
| 
       311 
374 
     | 
    
         
             
                    (@size && @size.is_a?(IDL::Expression::ScopedName) && @size.node.is_a?(IDL::AST::TemplateParam)) || @basetype.is_template?
         
     | 
| 
       312 
375 
     | 
    
         
             
                  end
         
     | 
| 
      
 376 
     | 
    
         
            +
             
     | 
| 
       313 
377 
     | 
    
         
             
                  def matches?(idltype)
         
     | 
| 
       314 
378 
     | 
    
         
             
                    super && self.size == idltype.size && self.basetype.resolved_type.matches?(idltype.basetype.resolved_type)
         
     | 
| 
       315 
379 
     | 
    
         
             
                  end
         
     | 
| 
      
 380 
     | 
    
         
            +
             
     | 
| 
       316 
381 
     | 
    
         
             
                  def instantiate(instantiation_context)
         
     | 
| 
       317 
382 
     | 
    
         
             
                    if self.is_template?
         
     | 
| 
       318 
383 
     | 
    
         
             
                      Type::Sequence.new(@basetype.instantiate(instantiation_context), @size ? @size.instantiate(instantiation_context).value : nil)
         
     | 
| 
         @@ -323,10 +388,11 @@ module IDL 
     | 
|
| 
       323 
388 
     | 
    
         
             
                end
         
     | 
| 
       324 
389 
     | 
    
         | 
| 
       325 
390 
     | 
    
         
             
                class Array < Type
         
     | 
| 
       326 
     | 
    
         
            -
                  attr_reader :basetype
         
     | 
| 
       327 
     | 
    
         
            -
             
     | 
| 
      
 391 
     | 
    
         
            +
                  attr_reader :basetype, :sizes
         
     | 
| 
      
 392 
     | 
    
         
            +
             
     | 
| 
       328 
393 
     | 
    
         
             
                  def initialize(t, sizes)
         
     | 
| 
       329 
394 
     | 
    
         
             
                    raise "Anonymous type definitions are not allowed!" if t.is_anonymous?
         
     | 
| 
      
 395 
     | 
    
         
            +
             
     | 
| 
       330 
396 
     | 
    
         
             
                    @basetype = t
         
     | 
| 
       331 
397 
     | 
    
         
             
                    if sizes.nil?
         
     | 
| 
       332 
398 
     | 
    
         
             
                      @sizes = []
         
     | 
| 
         @@ -336,27 +402,35 @@ module IDL 
     | 
|
| 
       336 
402 
     | 
    
         
             
                      @typename = t.typename + sizes.collect { |s| "[#{IDL::Expression::ScopedName === s ? s.node.name : s.to_s}]" }.join
         
     | 
| 
       337 
403 
     | 
    
         
             
                    end
         
     | 
| 
       338 
404 
     | 
    
         
             
                  end
         
     | 
| 
      
 405 
     | 
    
         
            +
             
     | 
| 
       339 
406 
     | 
    
         
             
                  def typename
         
     | 
| 
       340 
407 
     | 
    
         
             
                    @typename
         
     | 
| 
       341 
408 
     | 
    
         
             
                  end
         
     | 
| 
      
 409 
     | 
    
         
            +
             
     | 
| 
       342 
410 
     | 
    
         
             
                  def narrow(obj)
         
     | 
| 
       343 
411 
     | 
    
         
             
                    typeerror(obj)
         
     | 
| 
       344 
412 
     | 
    
         
             
                  end
         
     | 
| 
      
 413 
     | 
    
         
            +
             
     | 
| 
       345 
414 
     | 
    
         
             
                  def is_complete?
         
     | 
| 
       346 
415 
     | 
    
         
             
                    @basetype.resolved_type.is_complete?
         
     | 
| 
       347 
416 
     | 
    
         
             
                  end
         
     | 
| 
      
 417 
     | 
    
         
            +
             
     | 
| 
       348 
418 
     | 
    
         
             
                  def is_local?(recurstk = [])
         
     | 
| 
       349 
419 
     | 
    
         
             
                    @basetype.resolved_type.is_local?(recurstk)
         
     | 
| 
       350 
420 
     | 
    
         
             
                  end
         
     | 
| 
      
 421 
     | 
    
         
            +
             
     | 
| 
       351 
422 
     | 
    
         
             
                  def is_anonymous?
         
     | 
| 
       352 
423 
     | 
    
         
             
                    true
         
     | 
| 
       353 
424 
     | 
    
         
             
                  end
         
     | 
| 
      
 425 
     | 
    
         
            +
             
     | 
| 
       354 
426 
     | 
    
         
             
                  def is_template?
         
     | 
| 
       355 
427 
     | 
    
         
             
                    @sizes.any? { |sz| (sz.is_a?(IDL::Expression::ScopedName) && sz.node.is_a?(IDL::AST::TemplateParam)) } || @basetype.is_template?
         
     | 
| 
       356 
428 
     | 
    
         
             
                  end
         
     | 
| 
      
 429 
     | 
    
         
            +
             
     | 
| 
       357 
430 
     | 
    
         
             
                  def matches?(idltype)
         
     | 
| 
       358 
431 
     | 
    
         
             
                    super && self.sizes == idltype.sizes && self.basetype.resolved_type.matches?(idltype.basetype.resolved_type)
         
     | 
| 
       359 
432 
     | 
    
         
             
                  end
         
     | 
| 
      
 433 
     | 
    
         
            +
             
     | 
| 
       360 
434 
     | 
    
         
             
                  def instantiate(instantiation_context)
         
     | 
| 
       361 
435 
     | 
    
         
             
                    self.is_template? ? Type::Array.new(@basetype.instantiate(instantiation_context), @sizes.collect { |sz| sz.instantiate(instantiation_context).value }) : self
         
     | 
| 
       362 
436 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -364,11 +438,15 @@ module IDL 
     | 
|
| 
       364 
438 
     | 
    
         | 
| 
       365 
439 
     | 
    
         
             
                class WString < Type
         
     | 
| 
       366 
440 
     | 
    
         
             
                  attr_reader :size
         
     | 
| 
       367 
     | 
    
         
            -
             
     | 
| 
      
 441 
     | 
    
         
            +
             
     | 
| 
      
 442 
     | 
    
         
            +
                  def length
         
     | 
| 
      
 443 
     | 
    
         
            +
                    @size
         
     | 
| 
      
 444 
     | 
    
         
            +
                  end
         
     | 
| 
       368 
445 
     | 
    
         | 
| 
       369 
446 
     | 
    
         
             
                  def initialize(size = nil)
         
     | 
| 
       370 
447 
     | 
    
         
             
                    @size = size
         
     | 
| 
       371 
448 
     | 
    
         
             
                  end
         
     | 
| 
      
 449 
     | 
    
         
            +
             
     | 
| 
       372 
450 
     | 
    
         
             
                  def narrow(obj)
         
     | 
| 
       373 
451 
     | 
    
         
             
                    typeerror(obj) unless ::Array === obj
         
     | 
| 
       374 
452 
     | 
    
         
             
                    if @size.nil?
         
     | 
| 
         @@ -379,15 +457,19 @@ module IDL 
     | 
|
| 
       379 
457 
     | 
    
         
             
                      obj
         
     | 
| 
       380 
458 
     | 
    
         
             
                    end
         
     | 
| 
       381 
459 
     | 
    
         
             
                  end
         
     | 
| 
      
 460 
     | 
    
         
            +
             
     | 
| 
       382 
461 
     | 
    
         
             
                  def is_anonymous?
         
     | 
| 
       383 
462 
     | 
    
         
             
                    @size ? true : false
         
     | 
| 
       384 
463 
     | 
    
         
             
                  end
         
     | 
| 
      
 464 
     | 
    
         
            +
             
     | 
| 
       385 
465 
     | 
    
         
             
                  def is_template?
         
     | 
| 
       386 
466 
     | 
    
         
             
                    (@size && @size.is_a?(IDL::Expression::ScopedName) && @size.node.is_a?(IDL::AST::TemplateParam))
         
     | 
| 
       387 
467 
     | 
    
         
             
                  end
         
     | 
| 
      
 468 
     | 
    
         
            +
             
     | 
| 
       388 
469 
     | 
    
         
             
                  def matches?(idltype)
         
     | 
| 
       389 
470 
     | 
    
         
             
                    super && self.size == idltype.size
         
     | 
| 
       390 
471 
     | 
    
         
             
                  end
         
     | 
| 
      
 472 
     | 
    
         
            +
             
     | 
| 
       391 
473 
     | 
    
         
             
                  def instantiate(instantiation_context)
         
     | 
| 
       392 
474 
     | 
    
         
             
                    self.is_template? ? Type::WString.new(@size.instantiate(instantiation_context).value) : self
         
     | 
| 
       393 
475 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -438,6 +520,7 @@ module IDL 
     | 
|
| 
       438 
520 
     | 
    
         
             
                  def is_complete?
         
     | 
| 
       439 
521 
     | 
    
         
             
                    node.is_defined?
         
     | 
| 
       440 
522 
     | 
    
         
             
                  end
         
     | 
| 
      
 523 
     | 
    
         
            +
             
     | 
| 
       441 
524 
     | 
    
         
             
                  def is_local?(recurstk = [])
         
     | 
| 
       442 
525 
     | 
    
         
             
                    node.is_local?(recurstk)
         
     | 
| 
       443 
526 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -450,6 +533,7 @@ module IDL 
     | 
|
| 
       450 
533 
     | 
    
         
             
                  def is_complete?
         
     | 
| 
       451 
534 
     | 
    
         
             
                    node.is_defined?
         
     | 
| 
       452 
535 
     | 
    
         
             
                  end
         
     | 
| 
      
 536 
     | 
    
         
            +
             
     | 
| 
       453 
537 
     | 
    
         
             
                  def is_local?(recurstk = [])
         
     | 
| 
       454 
538 
     | 
    
         
             
                    node.is_local?(recurstk)
         
     | 
| 
       455 
539 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -462,6 +546,7 @@ module IDL 
     | 
|
| 
       462 
546 
     | 
    
         
             
                  def is_complete?
         
     | 
| 
       463 
547 
     | 
    
         
             
                    node.is_defined?
         
     | 
| 
       464 
548 
     | 
    
         
             
                  end
         
     | 
| 
      
 549 
     | 
    
         
            +
             
     | 
| 
       465 
550 
     | 
    
         
             
                  def is_local?(recurstk = [])
         
     | 
| 
       466 
551 
     | 
    
         
             
                    node.is_local?(recurstk)
         
     | 
| 
       467 
552 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -473,18 +558,23 @@ module IDL 
     | 
|
| 
       473 
558 
     | 
    
         
             
                    typeerror(obj) unless (0...@node.enumerators.length) === obj
         
     | 
| 
       474 
559 
     | 
    
         
             
                    obj
         
     | 
| 
       475 
560 
     | 
    
         
             
                  end
         
     | 
| 
      
 561 
     | 
    
         
            +
             
     | 
| 
       476 
562 
     | 
    
         
             
                  def range_length
         
     | 
| 
       477 
563 
     | 
    
         
             
                    @node.enumerators.length
         
     | 
| 
       478 
564 
     | 
    
         
             
                  end
         
     | 
| 
      
 565 
     | 
    
         
            +
             
     | 
| 
       479 
566 
     | 
    
         
             
                  def min
         
     | 
| 
       480 
567 
     | 
    
         
             
                    0
         
     | 
| 
       481 
568 
     | 
    
         
             
                  end
         
     | 
| 
      
 569 
     | 
    
         
            +
             
     | 
| 
       482 
570 
     | 
    
         
             
                  def max
         
     | 
| 
       483 
571 
     | 
    
         
             
                    @node.enumerators.length - 1
         
     | 
| 
       484 
572 
     | 
    
         
             
                  end
         
     | 
| 
      
 573 
     | 
    
         
            +
             
     | 
| 
       485 
574 
     | 
    
         
             
                  def in_range?(val)
         
     | 
| 
       486 
575 
     | 
    
         
             
                    val >= self.min && val <= self.max
         
     | 
| 
       487 
576 
     | 
    
         
             
                  end
         
     | 
| 
      
 577 
     | 
    
         
            +
             
     | 
| 
       488 
578 
     | 
    
         
             
                  def next(val)
         
     | 
| 
       489 
579 
     | 
    
         
             
                    val < self.max ? val + 1 : self.min
         
     | 
| 
       490 
580 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -492,41 +582,51 @@ module IDL 
     | 
|
| 
       492 
582 
     | 
    
         | 
| 
       493 
583 
     | 
    
         
             
                class Const < Type
         
     | 
| 
       494 
584 
     | 
    
         
             
                  attr_reader :type
         
     | 
| 
      
 585 
     | 
    
         
            +
             
     | 
| 
       495 
586 
     | 
    
         
             
                  def initialize(t)
         
     | 
| 
       496 
587 
     | 
    
         
             
                    @type = t
         
     | 
| 
       497 
588 
     | 
    
         
             
                    @typename = "const #{t.typename}"
         
     | 
| 
       498 
589 
     | 
    
         
             
                  end
         
     | 
| 
      
 590 
     | 
    
         
            +
             
     | 
| 
       499 
591 
     | 
    
         
             
                  def typename
         
     | 
| 
       500 
592 
     | 
    
         
             
                    @typename
         
     | 
| 
       501 
593 
     | 
    
         
             
                  end
         
     | 
| 
      
 594 
     | 
    
         
            +
             
     | 
| 
       502 
595 
     | 
    
         
             
                  def narrow(obj)
         
     | 
| 
       503 
596 
     | 
    
         
             
                    @type.narrow(obj)
         
     | 
| 
       504 
597 
     | 
    
         
             
                  end
         
     | 
| 
      
 598 
     | 
    
         
            +
             
     | 
| 
       505 
599 
     | 
    
         
             
                  def is_complete?
         
     | 
| 
       506 
600 
     | 
    
         
             
                    @type.resolved_type.is_complete?
         
     | 
| 
       507 
601 
     | 
    
         
             
                  end
         
     | 
| 
      
 602 
     | 
    
         
            +
             
     | 
| 
       508 
603 
     | 
    
         
             
                  def is_local?(recurstk = [])
         
     | 
| 
       509 
604 
     | 
    
         
             
                    @type.resolved_type.is_local?(recurstk)
         
     | 
| 
       510 
605 
     | 
    
         
             
                  end
         
     | 
| 
      
 606 
     | 
    
         
            +
             
     | 
| 
       511 
607 
     | 
    
         
             
                  def is_anonymous?
         
     | 
| 
       512 
608 
     | 
    
         
             
                    t.resolved_type.is_anonymous?
         
     | 
| 
       513 
609 
     | 
    
         
             
                  end
         
     | 
| 
      
 610 
     | 
    
         
            +
             
     | 
| 
       514 
611 
     | 
    
         
             
                  def is_template?
         
     | 
| 
       515 
612 
     | 
    
         
             
                    @type.is_template?
         
     | 
| 
       516 
613 
     | 
    
         
             
                  end
         
     | 
| 
      
 614 
     | 
    
         
            +
             
     | 
| 
       517 
615 
     | 
    
         
             
                  def instantiate(instantiation_context)
         
     | 
| 
       518 
616 
     | 
    
         
             
                    self.is_template? ? Type::Const.new(@type.instantiate(instantiation_context)) : self
         
     | 
| 
       519 
617 
     | 
    
         
             
                  end
         
     | 
| 
      
 618 
     | 
    
         
            +
             
     | 
| 
       520 
619 
     | 
    
         
             
                  def is_node?(node_class)
         
     | 
| 
       521 
620 
     | 
    
         
             
                    @type.is_node?(node_class)
         
     | 
| 
       522 
621 
     | 
    
         
             
                  end
         
     | 
| 
      
 622 
     | 
    
         
            +
             
     | 
| 
       523 
623 
     | 
    
         
             
                  def resolved_node
         
     | 
| 
       524 
624 
     | 
    
         
             
                    @type.resolved_node
         
     | 
| 
       525 
625 
     | 
    
         
             
                  end
         
     | 
| 
      
 626 
     | 
    
         
            +
             
     | 
| 
       526 
627 
     | 
    
         
             
                  def matches?(idltype)
         
     | 
| 
       527 
628 
     | 
    
         
             
                    super && self.type.resolved_type.matches?(idltype.type.resolved_type)
         
     | 
| 
       528 
629 
     | 
    
         
             
                  end
         
     | 
| 
       529 
630 
     | 
    
         
             
                end
         
     | 
| 
       530 
     | 
    
         
            -
             
     | 
| 
       531 
631 
     | 
    
         
             
              end
         
     | 
| 
       532 
632 
     | 
    
         
             
            end
         
     | 
    
        data/lib/ridl/version.rb
    CHANGED
    
    | 
         @@ -11,11 +11,9 @@ 
     | 
|
| 
       11 
11 
     | 
    
         
             
            #--------------------------------------------------------------------
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
13 
     | 
    
         
             
            module IDL
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
14 
     | 
    
         
             
              RIDL_VERSION_MAJOR = 2
         
     | 
| 
       16 
     | 
    
         
            -
              RIDL_VERSION_MINOR =  
     | 
| 
       17 
     | 
    
         
            -
              RIDL_VERSION_RELEASE =  
     | 
| 
      
 15 
     | 
    
         
            +
              RIDL_VERSION_MINOR = 9
         
     | 
| 
      
 16 
     | 
    
         
            +
              RIDL_VERSION_RELEASE = 0
         
     | 
| 
       18 
17 
     | 
    
         
             
              RIDL_VERSION = "#{RIDL_VERSION_MAJOR}.#{RIDL_VERSION_MINOR}.#{RIDL_VERSION_RELEASE}"
         
     | 
| 
       19 
18 
     | 
    
         
             
              RIDL_COPYRIGHT = "Copyright (c) 2007-#{Time.now.year} Remedy IT Expertise BV, The Netherlands".freeze
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
19 
     | 
    
         
             
            end
         
     | 
    
        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.9.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Martin Corino
         
     | 
| 
         @@ -9,11 +9,11 @@ authors: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date:  
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2023-03-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.
         
     | 
| 
       16 
     | 
    
         
            -
            email:  
     | 
| 
      
 16 
     | 
    
         
            +
            email: info@remedy.nl
         
     | 
| 
       17 
17 
     | 
    
         
             
            executables: []
         
     | 
| 
       18 
18 
     | 
    
         
             
            extensions: []
         
     | 
| 
       19 
19 
     | 
    
         
             
            extra_rdoc_files:
         
     | 
| 
         @@ -56,7 +56,7 @@ required_ruby_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       56 
56 
     | 
    
         
             
              requirements:
         
     | 
| 
       57 
57 
     | 
    
         
             
              - - ">="
         
     | 
| 
       58 
58 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       59 
     | 
    
         
            -
                  version: '2. 
     | 
| 
      
 59 
     | 
    
         
            +
                  version: '2.5'
         
     | 
| 
       60 
60 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       61 
61 
     | 
    
         
             
              requirements:
         
     | 
| 
       62 
62 
     | 
    
         
             
              - - ">="
         
     |