ridl 2.8.0 → 2.8.2
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 +4 -0
- data/lib/ridl/backend.rb +1 -1
- data/lib/ridl/delegate.rb +7 -7
- data/lib/ridl/expression.rb +13 -13
- data/lib/ridl/genfile.rb +2 -2
- data/lib/ridl/node.rb +27 -28
- data/lib/ridl/options.rb +1 -1
- data/lib/ridl/optparse_ext.rb +1 -1
- data/lib/ridl/parser.rb +456 -233
- data/lib/ridl/runner.rb +9 -9
- data/lib/ridl/scanner.rb +20 -21
- data/lib/ridl/type.rb +1 -1
- data/lib/ridl/version.rb +1 -1
- metadata +5 -5
data/lib/ridl/runner.rb
CHANGED
@@ -185,7 +185,7 @@ module IDL
|
|
185
185
|
@optparser.parse!(argv)
|
186
186
|
rescue ArgumentError => ex
|
187
187
|
IDL.error(ex.inspect)
|
188
|
-
IDL.error(ex.backtrace.join("\n")) if IDL.verbose_level>0
|
188
|
+
IDL.error(ex.backtrace.join("\n")) if IDL.verbose_level > 0
|
189
189
|
return false
|
190
190
|
end
|
191
191
|
|
@@ -201,7 +201,7 @@ module IDL
|
|
201
201
|
|
202
202
|
input_base = File.basename(argv.first)
|
203
203
|
if input_base != argv.first
|
204
|
-
options[:xincludepaths] << (File.dirname(argv.first)+'/')
|
204
|
+
options[:xincludepaths] << (File.dirname(argv.first) + '/')
|
205
205
|
end
|
206
206
|
|
207
207
|
return !parse("#include \"#{input_base}\"", options).nil?
|
@@ -222,7 +222,7 @@ module IDL
|
|
222
222
|
raise 'cannot read from STDOUT' if $stdout == _fio
|
223
223
|
|
224
224
|
# parse IDL source
|
225
|
-
IDL.log(1, "RIDL - parsing #{IO === _idlfile ? 'from STDIN': (StringIO === _idlfile ? 'from string' : _idlfile)}")
|
225
|
+
IDL.log(1, "RIDL - parsing #{IO === _idlfile ? 'from STDIN' : (StringIO === _idlfile ? 'from string' : _idlfile)}")
|
226
226
|
|
227
227
|
unless _parser = parse(_fio, _opts)
|
228
228
|
return false
|
@@ -248,7 +248,7 @@ module IDL
|
|
248
248
|
end
|
249
249
|
|
250
250
|
rescue Backend::ProcessStop
|
251
|
-
IDL.log(2, "RIDL - processing #{IO === _idlfile ? 'from STDIN': (StringIO === _idlfile ? 'from string' : _idlfile)} stopped with \"#{$!.message}\"")
|
251
|
+
IDL.log(2, "RIDL - processing #{IO === _idlfile ? 'from STDIN' : (StringIO === _idlfile ? 'from string' : _idlfile)} stopped with \"#{$!.message}\"")
|
252
252
|
|
253
253
|
rescue => ex
|
254
254
|
IDL.error(ex)
|
@@ -310,7 +310,7 @@ module IDL
|
|
310
310
|
end
|
311
311
|
_arg = _fpath unless _fpath.nil?
|
312
312
|
end
|
313
|
-
_opts[:xincludepaths] << (File.dirname(_arg)+'/')
|
313
|
+
_opts[:xincludepaths] << (File.dirname(_arg) + '/')
|
314
314
|
end
|
315
315
|
|
316
316
|
_opts[:outputdir] ||= '.'
|
@@ -329,20 +329,20 @@ module IDL
|
|
329
329
|
def init_optparser
|
330
330
|
script_name = File.basename($0, '.*')
|
331
331
|
if not script_name =~ /ridlc/
|
332
|
-
script_name = 'ruby '
|
332
|
+
script_name = 'ruby ' + $0
|
333
333
|
end
|
334
334
|
|
335
335
|
# set up option parser with common options
|
336
336
|
opts = OptionParser.new
|
337
337
|
opts.banner = "Usage: #{script_name} [:backend] [options] [<idlfile> [<idlfile> ...]]\n\n" +
|
338
|
-
" backend\t\tSpecifies the IDL language mapping backend to use.\n"+
|
339
|
-
" \t\tDefault = :null\n\n"+
|
338
|
+
" backend\t\tSpecifies the IDL language mapping backend to use.\n" +
|
339
|
+
" \t\tDefault = :null\n\n" +
|
340
340
|
" Active language mapping = :#{backend.name}"
|
341
341
|
opts.separator ''
|
342
342
|
opts.on('-I PATH', '--include=PATH', String,
|
343
343
|
'Adds include searchpath.',
|
344
344
|
'Default: none') { |v|
|
345
|
-
self.options[:includepaths] << (v.end_with?('\\','/') ? v : v+'/')
|
345
|
+
self.options[:includepaths] << (v.end_with?('\\', '/') ? v : v + '/')
|
346
346
|
}
|
347
347
|
opts.on('-Dmacro=[value]', String, 'defines preprocessor macro') { |v|
|
348
348
|
name, value = v.split('=')
|
data/lib/ridl/scanner.rb
CHANGED
@@ -9,7 +9,6 @@
|
|
9
9
|
#
|
10
10
|
# Copyright (c) Remedy IT Expertise BV
|
11
11
|
#--------------------------------------------------------------------
|
12
|
-
require 'racc/parser'
|
13
12
|
require 'delegate'
|
14
13
|
|
15
14
|
module IDL
|
@@ -73,14 +72,14 @@ module IDL
|
|
73
72
|
@pos.line += 1
|
74
73
|
@pos.column = 1
|
75
74
|
end
|
76
|
-
|
75
|
+
else
|
77
76
|
@pos.column += 1
|
78
77
|
end
|
79
78
|
|
80
79
|
if false
|
81
80
|
if not @bwd.nil? or cur.nil? or @fwd.nil?
|
82
81
|
printf("%c(%02x), %c(%02x), %c(%02x) @(l:%d,c:%d)\n",
|
83
|
-
@bwd
|
82
|
+
@bwd, @bwd, cur, cur, @fwd, @fwd, @pos.line, @pos.column)
|
84
83
|
end
|
85
84
|
end
|
86
85
|
@bwd = cur
|
@@ -281,7 +280,7 @@ module IDL
|
|
281
280
|
end
|
282
281
|
@stack << [:include, @prefix, @ifdef, @in, @ifskip]
|
283
282
|
# record file dir as new searchpath
|
284
|
-
@xincludepaths << (File.dirname(fpath)+'/')
|
283
|
+
@xincludepaths << (File.dirname(fpath) + '/')
|
285
284
|
@prefix = nil
|
286
285
|
@ifdef = Array.new
|
287
286
|
@in = In.new(File.open(fpath, 'r'), fpath)
|
@@ -299,7 +298,7 @@ module IDL
|
|
299
298
|
@expansions.include?(define)
|
300
299
|
end
|
301
300
|
def more_source?
|
302
|
-
@stack.size>0
|
301
|
+
@stack.size > 0
|
303
302
|
end
|
304
303
|
def in_expansion?
|
305
304
|
more_source? and @stack.last[0] == :define
|
@@ -308,7 +307,7 @@ module IDL
|
|
308
307
|
# make sure to close the input source
|
309
308
|
@in.close
|
310
309
|
# check if we have any previous source still stacked up
|
311
|
-
if @stack.size>0
|
310
|
+
if @stack.size > 0
|
312
311
|
if @stack.last[0] == :include
|
313
312
|
@xincludepaths.pop # remove directory of finished include
|
314
313
|
@directiver.leave_include
|
@@ -324,7 +323,7 @@ module IDL
|
|
324
323
|
@ifdef.empty? || @ifdef.last
|
325
324
|
end
|
326
325
|
def positions
|
327
|
-
@stack.reverse.inject(@in.nil? ? [] : [@in.position]) {|pos_arr,(_, _, _,in_, _)| pos_arr << in_.position }
|
326
|
+
@stack.reverse.inject(@in.nil? ? [] : [@in.position]) {|pos_arr, (_, _, _, in_, _)| pos_arr << in_.position }
|
328
327
|
end
|
329
328
|
def parse_error(msg, ex = nil)
|
330
329
|
e = IDL::ParseError.new(msg, positions)
|
@@ -334,7 +333,7 @@ module IDL
|
|
334
333
|
|
335
334
|
LFCR = [ (?\n), (?\r) ]
|
336
335
|
SPACES = [ (?\ ), (?\t) ]
|
337
|
-
WHITESPACE = SPACES+LFCR
|
336
|
+
WHITESPACE = SPACES + LFCR
|
338
337
|
|
339
338
|
ANNOTATION = ?@
|
340
339
|
ANNOTATION_STR = '@'
|
@@ -370,7 +369,7 @@ module IDL
|
|
370
369
|
long manages mirrorport module multiple native Object octet oneway out port porttype primarykey private provides
|
371
370
|
public publishes raises readonly setraises sequence short string struct supports switch TRUE truncatable typedef
|
372
371
|
typeid typename typeprefix unsigned union uses ValueBase valuetype void wchar wstring
|
373
|
-
).inject(TokenRegistry.new) { |h,a| h[a.downcase.to_sym] = a; h }
|
372
|
+
).inject(TokenRegistry.new) { |h, a| h[a.downcase.to_sym] = a; h }
|
374
373
|
|
375
374
|
LITERALS = [
|
376
375
|
:integer_literal,
|
@@ -477,7 +476,7 @@ module IDL
|
|
477
476
|
@scan_comment = false
|
478
477
|
end
|
479
478
|
# check identifier for keywords
|
480
|
-
if token
|
479
|
+
if token&.first == :identifier
|
481
480
|
# keyword check
|
482
481
|
if (a = KEYWORDS.assoc(token.last.to_s)).nil?
|
483
482
|
token = [ :identifier, Identifier.new(token.last.to_s, chk_identifier(token.last.to_s), token.last.unescaped_name) ]
|
@@ -760,7 +759,7 @@ module IDL
|
|
760
759
|
|
761
760
|
def resolve_define(id, stack = [])
|
762
761
|
return id if %w(true false).include?(id)
|
763
|
-
IDL.log(3,"*** RIDL - resolve_define(#{id})")
|
762
|
+
IDL.log(3, "*** RIDL - resolve_define(#{id})")
|
764
763
|
if @defined.has_key?(id)
|
765
764
|
define_ = @defined[id]
|
766
765
|
stack << id
|
@@ -773,7 +772,7 @@ module IDL
|
|
773
772
|
end
|
774
773
|
|
775
774
|
def eval_directive(s)
|
776
|
-
IDL.log(3,"** RIDL - eval_directive(#{s})")
|
775
|
+
IDL.log(3, "** RIDL - eval_directive(#{s})")
|
777
776
|
rc = eval(s)
|
778
777
|
case rc
|
779
778
|
when FalseClass, TrueClass
|
@@ -789,7 +788,7 @@ module IDL
|
|
789
788
|
@in.skipwhile {|c| SPACES.include?(c) }
|
790
789
|
s = getline
|
791
790
|
/^(\w*)\s*/ === s
|
792
|
-
s1,s2 = $1, $' #'
|
791
|
+
s1, s2 = $1, $' #'
|
793
792
|
|
794
793
|
if /(else|endif|elif)/ === s1
|
795
794
|
|
@@ -822,7 +821,7 @@ module IDL
|
|
822
821
|
else
|
823
822
|
while s2 =~ /(^|[\W])defined\s*\(\s*(\w+)\s*\)/
|
824
823
|
def_id = $2
|
825
|
-
s2.gsub!(/(^|[\W])(defined\s*\(\s*\w+\s*\))/, '\1'+"#{@defined.has_key?(def_id).to_s}")
|
824
|
+
s2.gsub!(/(^|[\W])(defined\s*\(\s*\w+\s*\))/, '\1' + "#{@defined.has_key?(def_id).to_s}")
|
826
825
|
end
|
827
826
|
s2.gsub!(/(^|[\W])([A-Za-z_][\w]*)/) do |_| "#{$1}#{resolve_define($2)}" end
|
828
827
|
begin
|
@@ -854,10 +853,10 @@ module IDL
|
|
854
853
|
if do_parse?
|
855
854
|
# match 'defined(Foo)' or 'defined Foo'
|
856
855
|
while s2 =~ /(^|[\W])defined(\s*\(\s*(\w+)\s*\)|\s+(\w+))/
|
857
|
-
IDL.log(3,"** RIDL - parse_directive : resolving 'defined(#{$3 || $4})'")
|
856
|
+
IDL.log(3, "** RIDL - parse_directive : resolving 'defined(#{$3 || $4})'")
|
858
857
|
def_id = $3 || $4
|
859
858
|
# resolve 'defined' expression to 'true' or 'false' according to actual macro definition
|
860
|
-
s2.gsub!(/(^|[\W])(defined\s*[\s\(]\s*#{def_id}(\s*\))?)/, '\1'+"#{@defined.has_key?(def_id).to_s}")
|
859
|
+
s2.gsub!(/(^|[\W])(defined\s*[\s\(]\s*#{def_id}(\s*\))?)/, '\1' + "#{@defined.has_key?(def_id).to_s}")
|
861
860
|
end
|
862
861
|
# match and resolve any macro variables listed in conditional expression
|
863
862
|
s2.gsub!(/(^|[\W])([A-Za-z_][\w]*)/) do |_| "#{$1}#{resolve_define($2)}" end
|
@@ -897,11 +896,11 @@ module IDL
|
|
897
896
|
@defined.delete(s2)
|
898
897
|
|
899
898
|
when 'include'
|
900
|
-
if s2[0,1] == '"' || s2[0,1] == '<'
|
901
|
-
quoted_inc = (s2[0,1] == '"')
|
902
|
-
if s2.size>2
|
899
|
+
if s2[0, 1] == '"' || s2[0, 1] == '<'
|
900
|
+
quoted_inc = (s2[0, 1] == '"')
|
901
|
+
if s2.size > 2
|
903
902
|
s2.strip!
|
904
|
-
s2 = s2.slice(1..(s2.size-2))
|
903
|
+
s2 = s2.slice(1..(s2.size - 2))
|
905
904
|
else
|
906
905
|
s2 = ''
|
907
906
|
end
|
@@ -941,7 +940,7 @@ module IDL
|
|
941
940
|
while true
|
942
941
|
ch = @in.getc
|
943
942
|
if ch.nil?
|
944
|
-
if @ifdef.size>0 and !in_expansion?
|
943
|
+
if @ifdef.size > 0 and !in_expansion?
|
945
944
|
parse_error 'mismatched #if/#endif'
|
946
945
|
end
|
947
946
|
if more_source?
|
data/lib/ridl/type.rb
CHANGED
data/lib/ridl/version.rb
CHANGED
@@ -14,7 +14,7 @@ module IDL
|
|
14
14
|
|
15
15
|
RIDL_VERSION_MAJOR = 2
|
16
16
|
RIDL_VERSION_MINOR = 8
|
17
|
-
RIDL_VERSION_RELEASE =
|
17
|
+
RIDL_VERSION_RELEASE = 2
|
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.8.
|
4
|
+
version: 2.8.2
|
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: 2022-12-21 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,14 +56,14 @@ 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
|
- - ">="
|
63
63
|
- !ruby/object:Gem::Version
|
64
64
|
version: '0'
|
65
65
|
requirements: []
|
66
|
-
rubygems_version: 3.1.
|
66
|
+
rubygems_version: 3.1.6
|
67
67
|
signing_key:
|
68
68
|
specification_version: 4
|
69
69
|
summary: Ruby OMG IDL compiler
|