mof 0.3.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.
data/History.txt ADDED
@@ -0,0 +1,4 @@
1
+ === 0.0.1 2010-10-03
2
+
3
+ * 1 major enhancement:
4
+ * Initial release
data/Manifest.txt ADDED
@@ -0,0 +1,10 @@
1
+ History.txt
2
+ Manifest.txt
3
+ README.rdoc
4
+ Rakefile
5
+ bin/moflint
6
+ lib/mof.rb
7
+ lib/mof/helper.rb
8
+ lib/mof/parser.rb
9
+ lib/mof/result.rb
10
+ lib/mof/scanner.rb
data/README.rdoc ADDED
@@ -0,0 +1,63 @@
1
+ = mof
2
+
3
+ * http://github.com/kkaempf/mof
4
+
5
+ == DESCRIPTION:
6
+
7
+ A parser for the Managed Object Format (MOF) language used to describe
8
+ classes and instances of the Common Information Model (CIM)
9
+
10
+ See http://www.dmtf.org/education/mof
11
+
12
+ == FEATURES/PROBLEMS:
13
+
14
+ * Uses Racc (Ruby Yacc) as parser generator
15
+ * Provides class information as Ruby objects (using the 'cim' gem)
16
+ * Can switch between DMTFs standard format and the one used in
17
+ Microsofts WMI implementation (http://msdn.microsoft.com/en-us/library/aa823192(VS.85).aspx)
18
+
19
+ == SYNOPSIS:
20
+
21
+ * A simple mof reader for validation of MOF files
22
+
23
+ require 'mof'
24
+ moffiles, options = Mofparser.argv_handler "moflint", ARGV
25
+ options[:style] ||= :cim;
26
+ options[:includes] ||= []
27
+ options[:includes].unshift(Pathname.new ".")
28
+ options[:includes].unshift(Pathname.new "/usr/share/mof/cim-current")
29
+
30
+ moffiles.unshift "qualifiers.mof" unless moffiles.include? "qualifiers.mof"
31
+
32
+ parser = Mofparser.new options
33
+
34
+ begin
35
+ result = parser.parse moffiles
36
+ rescue Exception => e
37
+ parser.error_handler e
38
+ exit 1
39
+ end
40
+
41
+ result.each do |name,res|
42
+ puts "/*=============== #{name} ===================*/\n"
43
+ puts res
44
+ end
45
+
46
+
47
+ == REQUIREMENTS:
48
+
49
+ * cim (http://rubygems.org/gems/cim)
50
+ (https://build.opensuse.org/package/show?package=rubygem-cim&project=devel:languages:ruby:extensions)
51
+
52
+ == INSTALL:
53
+
54
+ * sudo gem install cim
55
+ (or use rubygem-cim rpm)
56
+
57
+ == LICENSE:
58
+
59
+ (The Ruby License)
60
+
61
+ Copyright (c) 2010 Klaus Kämpf <kkaempf@suse.de>
62
+
63
+ See http://www.ruby-lang.org/en/LICENSE.txt for the full text
data/Rakefile ADDED
@@ -0,0 +1,29 @@
1
+ require 'rubygems'
2
+ gem 'hoe', '>= 2.1.0'
3
+ require 'hoe'
4
+ require 'fileutils'
5
+
6
+ Hoe.plugin :newgem
7
+ # Hoe.plugin :website
8
+ Hoe.plugin :cucumberfeatures
9
+
10
+ # Generate all the Rake tasks
11
+ # Run 'rake -T' to see list of generated tasks (from gem root directory)
12
+ $hoe = Hoe.spec 'mof' do
13
+ self.developer 'Klaus Kämpf', 'kkaempf@suse.de'
14
+ self.extra_deps = [['cim','>= 0.2.7']]
15
+
16
+ end
17
+
18
+ require 'newgem/tasks'
19
+ Dir['tasks/**/*.rake'].each { |t| load t }
20
+
21
+ # TODO - want other tests/tasks run by default? Add them to the list
22
+ # remove_task :default
23
+ # task :default => [:spec, :features]
24
+
25
+ task :default => [:test]
26
+
27
+ task :test => [:build]
28
+
29
+ task :build => ["lib/mof/parser.rb"]
data/bin/moflint ADDED
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # moflint
4
+ #
5
+ # MOF syntax checker
6
+ # and Mofparser tester
7
+ #
8
+ # Usage: moflint [-I <incdir>] <moffile> [ <moffile> ... ]
9
+ #
10
+
11
+ require 'rubygems'
12
+ require 'pathname'
13
+ require 'mof'
14
+
15
+ moffiles, options = MOF::Parser.argv_handler "moflint", ARGV
16
+ options[:style] ||= :cim;
17
+ options[:includes] ||= []
18
+ options[:includes].unshift(Pathname.new ".")
19
+
20
+ parser = MOF::Parser.new options
21
+
22
+ begin
23
+ result = parser.parse moffiles
24
+ rescue Exception => e
25
+ parser.error_handler e
26
+ exit 1
27
+ end
28
+
29
+ result.each do |name,res|
30
+ puts "/*=============== #{name} ===================*/\n"
31
+ puts res
32
+ end
data/lib/mof.rb ADDED
@@ -0,0 +1,7 @@
1
+ $:.unshift(File.dirname(__FILE__)) unless
2
+ $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
+
4
+ module MOF
5
+ VERSION = '0.3.0'
6
+ require "mof/parser"
7
+ end
data/lib/mof/helper.rb ADDED
@@ -0,0 +1,167 @@
1
+ #
2
+ # parse_helper.rb
3
+ #
4
+ # Helper functions for mofparser
5
+ #
6
+ #
7
+
8
+ module MOF
9
+ module Helper
10
+
11
+ require 'pathname'
12
+
13
+ def lineno
14
+ @lineno
15
+ end
16
+
17
+ def name
18
+ @name
19
+ end
20
+
21
+ def style
22
+ @style
23
+ end
24
+
25
+ #
26
+ # open file for parsing
27
+ #
28
+ # origin == :pragma for 'pragma include'
29
+ #
30
+ private
31
+ def open name, origin = nil
32
+ return if @seen_files.include? name
33
+ @seen_files << name
34
+ if name.kind_of? IO
35
+ file = name
36
+ else
37
+ $stderr.puts "open #{name} [#{origin}]" unless @quiet
38
+ file = nil
39
+ if name[0,1] == "/"
40
+ # absolute path
41
+ file = File.open( name ) if File.readable?( name )
42
+ else
43
+ # relative path, try each include dir
44
+ @includes.each do |incdir|
45
+ f = File.join(incdir, name)
46
+ # $stderr.puts "Trying '#{f}': #{File.exists?(f)}"
47
+ file = File.open( f ) if File.readable?( f )
48
+ break if file
49
+ # $stderr.puts "\tNope"
50
+ end
51
+ end
52
+ unless file
53
+ if name && name[0,1] != "/" # not absolute
54
+ dir = File.dirname(name) # try same dir as last file
55
+ f = File.join(dir, p)
56
+ file = File.open(f) if File.readable?( f )
57
+ end
58
+ end
59
+
60
+ unless file
61
+ return if origin == :pragma
62
+ $stderr.puts "'#{name}' not found, searched in"
63
+ @includes.each { |incdir| $stderr.puts " #{incdir}" }
64
+ raise "Cannot open #{name}"
65
+ end
66
+ end
67
+ @fstack << [ @file, @name, @lineno, @iconv, $/, @result ] if @file
68
+ @file = file
69
+ @name = name
70
+ @lineno = 1
71
+ @result = MOF::Result.new
72
+ # read the byte order mark to check for utf-16 windows files
73
+ bom = @file.read(2)
74
+ if bom == "\376\377"
75
+ @iconv = "UTF-16BE"
76
+ $/ = "\0\r\0\n"
77
+ elsif bom == "\377\376"
78
+ @iconv = "UTF-16LE"
79
+ $/ = "\r\0\n\0"
80
+ else
81
+ @file.rewind
82
+ @iconv = nil
83
+ $/ = "\n"
84
+ end
85
+ @style = :wmi if @iconv
86
+ # $stderr.puts "$/(#{$/.split('').inspect})"
87
+
88
+ end
89
+
90
+ #----------------------------------------------------------
91
+ # Error classes
92
+ #
93
+
94
+ # to be used to flag @style issues
95
+ class Error < ::SyntaxError
96
+ attr_reader :name, :lineno, :line, :msg
97
+ def initialize name, lineno, line, msg
98
+ @name,@lineno,@line,@msg = name, lineno, line, msg
99
+ end
100
+ def to_s
101
+ "#{@name}:#{@lineno}: #{line}\n#{msg}"
102
+ end
103
+ end
104
+
105
+ class ScannerError < Error
106
+ def initialize name, lineno, line, msg
107
+ super name,lineno,line,"Unrecognized '#{msg}'"
108
+ end
109
+ end
110
+
111
+ class ParserError < Error
112
+ attr_reader :line, :token, :token_value, :stack
113
+ def initialize name, lineno, line, token, token_value, stack
114
+ @token,@token_value,@stack = token, token_value, stack
115
+ super name,lineno,line,""
116
+ end
117
+ def to_s
118
+ ret = "#{super}\tnear token #{@token_value.inspect}\n"
119
+ ret << "\tStack [#{@stack.size}]:\n"
120
+ idx = stack.size-1
121
+ (1..12).each do |i|
122
+ s = stack[idx]
123
+ c = s.class
124
+ case s
125
+ when String, NilClass: s = s.inspect
126
+ else
127
+ s = s.to_s
128
+ end
129
+ if s.size > 80
130
+ ret << "[#{i}:#{c}]\t#{s[0,80]}..."
131
+ else
132
+ ret << "[#{i}:#{c}]\t#{s}"
133
+ end
134
+ ret << "\n"
135
+ idx -= 1
136
+ break if idx < 0
137
+ end
138
+ ret
139
+ end
140
+ end
141
+
142
+ class StyleError < Error
143
+ end
144
+
145
+ public
146
+ #
147
+ # error_handler
148
+ #
149
+ def error_handler e
150
+ $stderr.puts "*** #{@name}:#{@lineno}:"
151
+ case e
152
+ when StyleError
153
+ $stderr.puts "\t Syntax does not comply to '#{self.style}' style"
154
+ when ScannerError
155
+ $stderr.puts "\t ScannerError: #{$!}"
156
+ when ParserError
157
+ $stderr.puts "\t ParserError: #{$!}"
158
+ when Error
159
+ $stderr.puts "\t Error: #{$!}"
160
+ else
161
+ $stderr.puts "\t Exception: #{$!}[#{$!.class}]"
162
+ $stderr.puts $@
163
+ end
164
+ end
165
+
166
+ end # module Helper
167
+ end # module MOF
data/lib/mof/parser.rb ADDED
@@ -0,0 +1,1380 @@
1
+ #
2
+ # DO NOT MODIFY!!!!
3
+ # This file is automatically generated by racc 1.4.5
4
+ # from racc grammer file "lib/mof/parser.y".
5
+ #
6
+
7
+ require 'racc/parser'
8
+
9
+
10
+
11
+ # parser.rb - generated by racc
12
+
13
+ require 'strscan'
14
+ require 'rubygems'
15
+ require 'cim'
16
+ require File.join(File.dirname(__FILE__), 'result')
17
+ require File.join(File.dirname(__FILE__), 'scanner')
18
+ require File.join(File.dirname(__FILE__), 'helper')
19
+
20
+
21
+ module MOF
22
+
23
+ class Parser < Racc::Parser
24
+
25
+ module_eval <<'..end lib/mof/parser.y modeval..id77656aaeab', 'lib/mof/parser.y', 596
26
+
27
+ #
28
+ # Initialize MOF::Parser
29
+ # MOF::Parser.new options = {}
30
+ #
31
+ # options -> Hash of options
32
+ # :debug -> bool
33
+ # :includes -> array of include dirs
34
+ # :style -> :cim or :wmi
35
+ #
36
+ def initialize options = {}
37
+ @yydebug = options[:debug]
38
+ @includes = options[:includes] || []
39
+ @quiet = options[:quiet]
40
+ @style = options[:style] || :cim # default to style CIM v2.2 syntax
41
+
42
+ @lineno = 1
43
+ @file = nil
44
+ @iconv = nil
45
+ @eol = "\n"
46
+ @fname = nil
47
+ @fstack = []
48
+ @in_comment = false
49
+ @seen_files = []
50
+ @qualifiers = {}
51
+ end
52
+
53
+ #
54
+ # Make options hash from argv
55
+ #
56
+ # returns [ files, options ]
57
+ #
58
+
59
+ def self.argv_handler name, argv
60
+ files = []
61
+ options = { :namespace => "" }
62
+ while argv.size > 0
63
+ case opt = argv.shift
64
+ when "-h":
65
+ $stderr.puts "Ruby MOF compiler"
66
+ $stderr.puts "#{name} [-h] [-d] [-I <dir>] [<moffiles>]"
67
+ $stderr.puts "Compiles <moffile>"
68
+ $stderr.puts "\t-d debug"
69
+ $stderr.puts "\t-h this help"
70
+ $stderr.puts "\t-I <dir> include dir"
71
+ $stderr.puts "\t-n <namespace>"
72
+ $stderr.puts "\t-o <output>"
73
+ $stderr.puts "\t-s <style> syntax style (wmi,cim)"
74
+ $stderr.puts "\t-q quiet"
75
+ $stderr.puts "\t<moffiles> file(s) to read (else use $stdin)"
76
+ exit 0
77
+ when "-s": options[:style] = argv.shift.to_sym
78
+ when "-d": options[:debug] = true
79
+ when "-q": options[:quiet] = true
80
+ when "-I"
81
+ options[:includes] ||= []
82
+ dirname = argv.shift
83
+ unless File.directory?(dirname)
84
+ files << dirname
85
+ dirname = File.dirname(dirname)
86
+ end
87
+ options[:includes] << Pathname.new(dirname)
88
+ when "-n": options[:namespace] = argv.shift
89
+ when "-o": options[:output] = argv.shift
90
+ when /^-.+/:
91
+ $stderr.puts "Undefined option #{opt}"
92
+ else
93
+ files << opt
94
+ end
95
+ end
96
+ [ files, options ]
97
+ end
98
+
99
+ include Helper
100
+ include Scanner
101
+
102
+ ..end lib/mof/parser.y modeval..id77656aaeab
103
+
104
+ ##### racc 1.4.5 generates ###
105
+
106
+ racc_reduce_table = [
107
+ 0, 0, :racc_error,
108
+ 0, 71, :_reduce_1,
109
+ 1, 71, :_reduce_2,
110
+ 2, 71, :_reduce_3,
111
+ 1, 72, :_reduce_none,
112
+ 1, 72, :_reduce_5,
113
+ 1, 72, :_reduce_6,
114
+ 1, 72, :_reduce_7,
115
+ 4, 73, :_reduce_8,
116
+ 4, 73, :_reduce_none,
117
+ 3, 73, :_reduce_10,
118
+ 1, 78, :_reduce_none,
119
+ 0, 77, :_reduce_12,
120
+ 3, 77, :_reduce_13,
121
+ 1, 79, :_reduce_none,
122
+ 3, 79, :_reduce_none,
123
+ 1, 80, :_reduce_none,
124
+ 1, 80, :_reduce_17,
125
+ 1, 80, :_reduce_none,
126
+ 9, 74, :_reduce_19,
127
+ 0, 87, :_reduce_none,
128
+ 2, 87, :_reduce_21,
129
+ 1, 88, :_reduce_none,
130
+ 1, 88, :_reduce_none,
131
+ 1, 88, :_reduce_none,
132
+ 0, 83, :_reduce_none,
133
+ 1, 83, :_reduce_none,
134
+ 4, 92, :_reduce_27,
135
+ 0, 94, :_reduce_28,
136
+ 3, 94, :_reduce_29,
137
+ 3, 93, :_reduce_30,
138
+ 0, 97, :_reduce_none,
139
+ 2, 97, :_reduce_32,
140
+ 1, 98, :_reduce_33,
141
+ 2, 98, :_reduce_34,
142
+ 0, 96, :_reduce_none,
143
+ 1, 96, :_reduce_none,
144
+ 3, 100, :_reduce_37,
145
+ 1, 100, :_reduce_none,
146
+ 1, 99, :_reduce_none,
147
+ 1, 99, :_reduce_none,
148
+ 1, 99, :_reduce_none,
149
+ 1, 99, :_reduce_none,
150
+ 1, 99, :_reduce_none,
151
+ 1, 99, :_reduce_none,
152
+ 1, 99, :_reduce_45,
153
+ 0, 85, :_reduce_none,
154
+ 1, 85, :_reduce_none,
155
+ 0, 86, :_reduce_none,
156
+ 1, 86, :_reduce_none,
157
+ 1, 84, :_reduce_50,
158
+ 2, 103, :_reduce_51,
159
+ 2, 105, :_reduce_52,
160
+ 2, 104, :_reduce_53,
161
+ 6, 89, :_reduce_54,
162
+ 6, 91, :_reduce_55,
163
+ 7, 90, :_reduce_56,
164
+ 1, 107, :_reduce_none,
165
+ 1, 107, :_reduce_58,
166
+ 1, 111, :_reduce_none,
167
+ 1, 111, :_reduce_60,
168
+ 1, 112, :_reduce_none,
169
+ 1, 106, :_reduce_none,
170
+ 1, 106, :_reduce_none,
171
+ 1, 106, :_reduce_none,
172
+ 1, 106, :_reduce_none,
173
+ 1, 106, :_reduce_none,
174
+ 1, 106, :_reduce_none,
175
+ 1, 106, :_reduce_none,
176
+ 1, 106, :_reduce_none,
177
+ 1, 106, :_reduce_none,
178
+ 1, 106, :_reduce_none,
179
+ 1, 106, :_reduce_none,
180
+ 1, 106, :_reduce_none,
181
+ 1, 106, :_reduce_none,
182
+ 1, 106, :_reduce_none,
183
+ 1, 106, :_reduce_76,
184
+ 1, 110, :_reduce_77,
185
+ 2, 110, :_reduce_78,
186
+ 0, 113, :_reduce_none,
187
+ 1, 113, :_reduce_none,
188
+ 2, 114, :_reduce_81,
189
+ 0, 116, :_reduce_none,
190
+ 3, 116, :_reduce_83,
191
+ 5, 115, :_reduce_84,
192
+ 1, 117, :_reduce_none,
193
+ 1, 117, :_reduce_none,
194
+ 1, 118, :_reduce_none,
195
+ 0, 108, :_reduce_none,
196
+ 1, 108, :_reduce_none,
197
+ 0, 119, :_reduce_none,
198
+ 1, 119, :_reduce_91,
199
+ 3, 120, :_reduce_92,
200
+ 0, 122, :_reduce_93,
201
+ 1, 122, :_reduce_none,
202
+ 0, 109, :_reduce_none,
203
+ 1, 109, :_reduce_none,
204
+ 2, 121, :_reduce_97,
205
+ 1, 123, :_reduce_none,
206
+ 1, 123, :_reduce_none,
207
+ 1, 123, :_reduce_none,
208
+ 3, 102, :_reduce_101,
209
+ 0, 125, :_reduce_none,
210
+ 1, 125, :_reduce_103,
211
+ 3, 125, :_reduce_104,
212
+ 1, 101, :_reduce_none,
213
+ 1, 101, :_reduce_none,
214
+ 1, 101, :_reduce_none,
215
+ 1, 101, :_reduce_none,
216
+ 1, 101, :_reduce_none,
217
+ 1, 101, :_reduce_none,
218
+ 1, 101, :_reduce_111,
219
+ 1, 82, :_reduce_none,
220
+ 1, 82, :_reduce_none,
221
+ 1, 82, :_reduce_none,
222
+ 1, 82, :_reduce_none,
223
+ 1, 82, :_reduce_none,
224
+ 1, 81, :_reduce_none,
225
+ 2, 81, :_reduce_118,
226
+ 1, 124, :_reduce_none,
227
+ 1, 124, :_reduce_none,
228
+ 2, 127, :_reduce_none,
229
+ 0, 128, :_reduce_none,
230
+ 2, 128, :_reduce_none,
231
+ 1, 130, :_reduce_none,
232
+ 3, 129, :_reduce_none,
233
+ 2, 131, :_reduce_none,
234
+ 0, 133, :_reduce_none,
235
+ 3, 133, :_reduce_none,
236
+ 3, 132, :_reduce_none,
237
+ 1, 134, :_reduce_none,
238
+ 1, 134, :_reduce_none,
239
+ 6, 75, :_reduce_132,
240
+ 0, 137, :_reduce_none,
241
+ 1, 137, :_reduce_none,
242
+ 1, 95, :_reduce_none,
243
+ 1, 95, :_reduce_none,
244
+ 1, 95, :_reduce_none,
245
+ 1, 95, :_reduce_none,
246
+ 4, 135, :_reduce_139,
247
+ 5, 136, :_reduce_140,
248
+ 1, 139, :_reduce_141,
249
+ 3, 139, :_reduce_142,
250
+ 1, 140, :_reduce_none,
251
+ 1, 140, :_reduce_none,
252
+ 1, 140, :_reduce_none,
253
+ 1, 140, :_reduce_none,
254
+ 1, 140, :_reduce_none,
255
+ 1, 140, :_reduce_none,
256
+ 1, 140, :_reduce_none,
257
+ 1, 140, :_reduce_none,
258
+ 1, 140, :_reduce_none,
259
+ 1, 140, :_reduce_none,
260
+ 5, 138, :_reduce_153,
261
+ 1, 141, :_reduce_154,
262
+ 3, 141, :_reduce_155,
263
+ 2, 76, :_reduce_none,
264
+ 8, 126, :_reduce_none,
265
+ 1, 142, :_reduce_none,
266
+ 2, 142, :_reduce_none,
267
+ 5, 143, :_reduce_none,
268
+ 3, 143, :_reduce_161 ]
269
+
270
+ racc_reduce_n = 162
271
+
272
+ racc_shift_n = 237
273
+
274
+ racc_action_table = [
275
+ 16, 170, 149, 170, 165, 135, 165, 19, 162, 163,
276
+ 154, 28, 29, 170, 8, 166, 165, 166, 160, 8,
277
+ 164, 153, 155, 156, 157, 18, 149, 166, 125, 159,
278
+ 115, 116, 117, 118, 119, 120, 121, 198, 35, 201,
279
+ 165, 49, 51, 84, 87, 88, 89, 55, 56, 46,
280
+ 47, 149, 1, 166, 178, 42, 10, 1, 10, 10,
281
+ 41, 98, 127, 42, 10, 49, 51, 84, 87, 88,
282
+ 89, 55, 56, 46, 47, 54, 187, 129, -79, 42,
283
+ 132, 186, 10, 10, 79, 98, 54, 184, 185, 80,
284
+ 49, 51, 84, 87, 88, 89, 55, 56, 46, 47,
285
+ 22, 133, 24, 20, 42, 134, 22, 10, 24, 20,
286
+ 98, 35, 124, 23, 49, 51, 112, 18, 113, 23,
287
+ 55, 56, 46, 47, 96, 49, 51, 35, 172, 10,
288
+ 10, 55, 56, 46, 47, 75, 62, 64, 66, 67,
289
+ 68, 69, 70, 72, 73, 74, 76, 61, 63, 65,
290
+ -25, 75, 62, 64, 66, 67, 68, 69, 70, 72,
291
+ 73, 74, 76, 61, 63, 65, 94, 95, 13, 14,
292
+ 49, 51, 84, 87, 88, 89, 55, 56, 46, 47,
293
+ 162, 163, 154, 193, 194, 111, 22, 10, 24, 20,
294
+ 160, 151, 164, 153, 155, 156, 157, 152, 109, 23,
295
+ 106, 159, 49, 51, 84, 87, 88, 89, 55, 56,
296
+ 46, 47, 115, 116, 117, 118, 119, 120, 121, 10,
297
+ 49, 51, 84, 87, 88, 89, 55, 56, 46, 47,
298
+ 115, 116, 117, 118, 119, 120, 121, 10, 75, 62,
299
+ 64, 66, 67, 68, 69, 70, 72, 73, 74, 76,
300
+ 61, 63, 65, 115, 116, 117, 118, 119, 120, 121,
301
+ 104, 100, 35, 181, 98, 59, 96, 92, 191, 192,
302
+ 78, 59, 35, 31, 199, 31, 36, 35, 207, 104,
303
+ 209, -61, 104, 212, 129, 33, 129, 219, 32, 221,
304
+ 222, 31, 227, 15, 229, 230, 231, 10, 104, 129 ]
305
+
306
+ racc_action_check = [
307
+ 4, 139, 212, 192, 139, 109, 192, 5, 185, 185,
308
+ 185, 13, 13, 219, 0, 139, 219, 192, 185, 4,
309
+ 185, 185, 185, 185, 185, 5, 129, 219, 98, 185,
310
+ 92, 92, 92, 92, 92, 92, 92, 188, 100, 190,
311
+ 188, 212, 212, 212, 212, 212, 212, 212, 212, 212,
312
+ 212, 186, 0, 190, 141, 212, 141, 4, 212, 0,
313
+ 26, 212, 102, 26, 4, 129, 129, 129, 129, 129,
314
+ 129, 129, 129, 129, 129, 95, 168, 103, 209, 129,
315
+ 104, 168, 129, 209, 38, 129, 31, 158, 158, 38,
316
+ 186, 186, 186, 186, 186, 186, 186, 186, 186, 186,
317
+ 79, 106, 79, 79, 186, 107, 10, 186, 10, 10,
318
+ 186, 177, 97, 79, 95, 95, 91, 86, 91, 10,
319
+ 95, 95, 95, 95, 82, 31, 31, 217, 140, 124,
320
+ 140, 31, 31, 31, 31, 177, 177, 177, 177, 177,
321
+ 177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
322
+ 42, 217, 217, 217, 217, 217, 217, 217, 217, 217,
323
+ 217, 217, 217, 217, 217, 217, 48, 48, 1, 1,
324
+ 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
325
+ 135, 135, 135, 183, 183, 81, 8, 42, 8, 8,
326
+ 135, 131, 135, 135, 135, 135, 135, 133, 78, 8,
327
+ 77, 135, 41, 41, 41, 41, 41, 41, 41, 41,
328
+ 41, 41, 194, 194, 194, 194, 194, 194, 194, 41,
329
+ 112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
330
+ 152, 152, 152, 152, 152, 152, 152, 112, 36, 36,
331
+ 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
332
+ 36, 36, 36, 122, 122, 122, 122, 122, 122, 122,
333
+ 71, 60, 148, 150, 59, 57, 52, 43, 178, 179,
334
+ 37, 34, 33, 28, 189, 27, 21, 19, 196, 197,
335
+ 200, 201, 202, 204, 208, 18, 210, 211, 16, 213,
336
+ 214, 14, 218, 3, 222, 223, 226, 230, 232, 234 ]
337
+
338
+ racc_action_pointer = [
339
+ -5, 162, nil, 230, 0, -2, nil, nil, 178, nil,
340
+ 98, nil, nil, 4, 233, nil, 288, nil, 254, 269,
341
+ nil, 210, nil, nil, nil, nil, 2, 217, 215, nil,
342
+ nil, 78, nil, 264, 243, nil, 206, 210, 24, nil,
343
+ nil, 155, 123, 201, nil, nil, nil, nil, 107, nil,
344
+ nil, nil, 218, nil, nil, nil, nil, 237, nil, 197,
345
+ 195, nil, nil, nil, nil, nil, nil, nil, nil, nil,
346
+ nil, 196, nil, nil, nil, nil, nil, 140, 178, 92,
347
+ nil, 126, 76, nil, nil, nil, 90, nil, nil, nil,
348
+ nil, 56, 18, nil, nil, 67, nil, 51, 20, nil,
349
+ 30, nil, 1, 9, 33, nil, 75, 42, nil, -53,
350
+ nil, nil, 173, nil, nil, nil, nil, nil, nil, nil,
351
+ nil, nil, 241, nil, 65, nil, nil, nil, nil, 18,
352
+ nil, 126, nil, 139, nil, 171, nil, nil, nil, -7,
353
+ 66, -8, nil, nil, nil, nil, nil, nil, 254, nil,
354
+ 197, nil, 218, nil, nil, nil, nil, nil, 28, nil,
355
+ nil, nil, nil, nil, nil, nil, nil, nil, 13, nil,
356
+ nil, nil, nil, nil, nil, nil, nil, 103, 205, 200,
357
+ nil, nil, nil, 124, nil, -1, 43, nil, 29, 245,
358
+ 31, nil, -5, nil, 200, nil, 215, 215, nil, nil,
359
+ 222, 223, 218, nil, 215, nil, nil, nil, 216, 19,
360
+ 218, 227, -6, 226, 231, nil, nil, 119, 229, 5,
361
+ nil, nil, 231, 235, nil, nil, 288, nil, nil, nil,
362
+ 233, nil, 234, nil, 231, nil, nil ]
363
+
364
+ racc_action_default = [
365
+ -1, -162, -26, -162, -25, -162, -2, -4, -162, -5,
366
+ -162, -6, -7, -162, -12, -156, -162, -3, -162, -162,
367
+ -137, -162, -135, -138, -136, -28, -35, -12, -12, -11,
368
+ -10, -162, 237, -162, -46, -50, -162, -162, -162, -36,
369
+ -38, -25, -102, -31, -9, -8, -114, -116, -162, -115,
370
+ -14, -117, -16, -17, -18, -112, -113, -46, -47, -162,
371
+ -48, -73, -62, -74, -63, -75, -64, -65, -66, -67,
372
+ -68, -88, -69, -70, -71, -76, -72, -133, -162, -162,
373
+ -27, -162, -108, -111, -106, -105, -162, -107, -109, -110,
374
+ -103, -162, -162, -30, -13, -162, -118, -162, -162, -51,
375
+ -162, -49, -162, -95, -93, -89, -162, -162, -134, -162,
376
+ -29, -37, -25, -101, -33, -39, -40, -41, -42, -43,
377
+ -45, -44, -32, -15, -25, -52, -53, -20, -96, -25,
378
+ -139, -162, -94, -162, -132, -162, -104, -34, -158, -162,
379
+ -25, -25, -98, -97, -100, -99, -120, -119, -162, -124,
380
+ -162, -92, -162, -148, -146, -149, -150, -151, -162, -152,
381
+ -147, -141, -144, -145, -143, -60, -58, -131, -162, -130,
382
+ -57, -159, -157, -21, -22, -23, -24, -162, -162, -162,
383
+ -121, -123, -154, -162, -140, -162, -25, -161, -162, -77,
384
+ -162, -19, -162, -153, -162, -142, -162, -88, -59, -78,
385
+ -162, -57, -88, -127, -162, -125, -155, -160, -95, -25,
386
+ -95, -126, -25, -162, -162, -80, -82, -162, -162, -162,
387
+ -129, -55, -162, -81, -86, -85, -162, -54, -128, -56,
388
+ -25, -87, -88, -83, -90, -91, -84 ]
389
+
390
+ racc_goto_table = [
391
+ 5, 71, 103, 34, 5, 130, 114, 143, 81, 90,
392
+ 52, 25, 50, 53, 188, 161, 203, 57, 60, 216,
393
+ 30, 138, 6, 3, 91, 122, 17, 3, 43, 39,
394
+ 21, 40, 101, 44, 45, 99, 137, 171, 38, 202,
395
+ 233, 97, 176, 228, 175, 174, 197, 200, 214, 215,
396
+ 173, 223, 226, 232, 224, 236, 235, 131, 141, 93,
397
+ 102, 180, 205, 48, 196, 195, 182, 211, 168, 37,
398
+ 77, 107, 108, 158, 52, 27, 123, 53, 183, 136,
399
+ 110, 140, 4, nil, 126, nil, nil, nil, nil, nil,
400
+ 220, nil, nil, nil, nil, nil, nil, nil, nil, nil,
401
+ nil, nil, nil, nil, nil, nil, nil, nil, 206, nil,
402
+ 213, nil, 218, nil, nil, nil, nil, nil, nil, nil,
403
+ nil, nil, nil, nil, 139, nil, nil, nil, 208, nil,
404
+ nil, nil, 179, 210, nil, nil, nil, nil, nil, nil,
405
+ 139, 177, 190, nil, nil, nil, nil, nil, nil, nil,
406
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
407
+ nil, nil, nil, 234, nil, nil, nil, nil, nil, nil,
408
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
409
+ nil, nil, 225, nil, nil, nil, nil, nil, nil, nil,
410
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
411
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, 217,
412
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
413
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
414
+ 217 ]
415
+
416
+ racc_goto_check = [
417
+ 13, 36, 38, 14, 13, 39, 29, 53, 31, 31,
418
+ 11, 23, 10, 12, 40, 70, 62, 14, 15, 45,
419
+ 7, 73, 2, 56, 55, 28, 2, 56, 26, 30,
420
+ 25, 32, 34, 7, 7, 35, 29, 73, 24, 37,
421
+ 45, 15, 21, 62, 20, 19, 41, 42, 43, 44,
422
+ 18, 46, 47, 48, 40, 49, 51, 52, 17, 27,
423
+ 16, 59, 61, 9, 53, 70, 29, 63, 64, 65,
424
+ 66, 67, 68, 69, 11, 8, 10, 12, 71, 31,
425
+ 23, 72, 1, nil, 14, nil, nil, nil, nil, nil,
426
+ 53, nil, nil, nil, nil, nil, nil, nil, nil, nil,
427
+ nil, nil, nil, nil, nil, nil, nil, nil, 29, nil,
428
+ 39, nil, 39, nil, nil, nil, nil, nil, nil, nil,
429
+ nil, nil, nil, nil, 13, nil, nil, nil, 38, nil,
430
+ nil, nil, 14, 38, nil, nil, nil, nil, nil, nil,
431
+ 13, 13, 36, nil, nil, nil, nil, nil, nil, nil,
432
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
433
+ nil, nil, nil, 38, nil, nil, nil, nil, nil, nil,
434
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
435
+ nil, nil, 36, nil, nil, nil, nil, nil, nil, nil,
436
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
437
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, 13,
438
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
439
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
440
+ 13 ]
441
+
442
+ racc_goto_pointer = [
443
+ nil, 82, 22, nil, nil, nil, nil, 6, 62, 32,
444
+ -19, -21, -18, 0, -16, -16, 0, -69, -91, -96,
445
+ -97, -99, nil, 1, 13, 22, 2, 16, -67, -86,
446
+ 3, -33, 5, nil, -28, -24, -35, -151, -69, -98,
447
+ -163, -142, -143, -161, -160, -190, -165, -165, -173, -179,
448
+ nil, -178, -47, -122, nil, -18, 23, nil, nil, -87,
449
+ nil, -130, -176, -136, -71, 48, 33, -6, -5, -62,
450
+ -120, -74, -43, -103 ]
451
+
452
+ racc_goto_default = [
453
+ nil, nil, nil, 7, 9, 11, 12, nil, nil, nil,
454
+ nil, 82, 85, 86, 189, nil, nil, nil, nil, nil,
455
+ nil, nil, 2, nil, nil, 26, nil, nil, nil, nil,
456
+ nil, 142, 145, 58, nil, 146, nil, 169, nil, nil,
457
+ nil, 167, nil, nil, nil, nil, nil, nil, nil, nil,
458
+ 105, 128, nil, nil, 144, nil, 83, 147, 148, nil,
459
+ 150, nil, nil, nil, 204, nil, nil, nil, nil, nil,
460
+ nil, nil, nil, nil ]
461
+
462
+ racc_token_table = {
463
+ false => 0,
464
+ Object.new => 1,
465
+ "*" => 2,
466
+ "/" => 3,
467
+ "+" => 4,
468
+ "-" => 5,
469
+ :PRAGMA => 6,
470
+ :INCLUDE => 7,
471
+ :IDENTIFIER => 8,
472
+ :CLASS => 9,
473
+ :ASSOCIATION => 10,
474
+ :INDICATION => 11,
475
+ :AMENDED => 12,
476
+ :ENABLEOVERRIDE => 13,
477
+ :DISABLEOVERRIDE => 14,
478
+ :RESTRICTED => 15,
479
+ :TOSUBCLASS => 16,
480
+ :TOINSTANCE => 17,
481
+ :TRANSLATABLE => 18,
482
+ :QUALIFIER => 19,
483
+ :SCOPE => 20,
484
+ :SCHEMA => 21,
485
+ :PROPERTY => 22,
486
+ :REFERENCE => 23,
487
+ :METHOD => 24,
488
+ :PARAMETER => 25,
489
+ :FLAVOR => 26,
490
+ :INSTANCE => 27,
491
+ :AS => 28,
492
+ :REF => 29,
493
+ :ANY => 30,
494
+ :OF => 31,
495
+ :DT_VOID => 32,
496
+ :DT_UINT8 => 33,
497
+ :DT_SINT8 => 34,
498
+ :DT_UINT16 => 35,
499
+ :DT_SINT16 => 36,
500
+ :DT_UINT32 => 37,
501
+ :DT_SINT32 => 38,
502
+ :DT_UINT64 => 39,
503
+ :DT_SINT64 => 40,
504
+ :DT_REAL32 => 41,
505
+ :DT_REAL64 => 42,
506
+ :DT_CHAR16 => 43,
507
+ :DT_STR => 44,
508
+ :DT_BOOL => 45,
509
+ :DT_DATETIME => 46,
510
+ :positiveDecimalValue => 47,
511
+ :stringValue => 48,
512
+ :realValue => 49,
513
+ :charValue => 50,
514
+ :booleanValue => 51,
515
+ :nullValue => 52,
516
+ :binaryValue => 53,
517
+ :octalValue => 54,
518
+ :decimalValue => 55,
519
+ :hexValue => 56,
520
+ "#" => 57,
521
+ "(" => 58,
522
+ ")" => 59,
523
+ "," => 60,
524
+ "{" => 61,
525
+ "}" => 62,
526
+ ";" => 63,
527
+ "[" => 64,
528
+ "]" => 65,
529
+ ":" => 66,
530
+ "$" => 67,
531
+ "=" => 68,
532
+ "." => 69 }
533
+
534
+ racc_use_result_var = true
535
+
536
+ racc_nt_base = 70
537
+
538
+ Racc_arg = [
539
+ racc_action_table,
540
+ racc_action_check,
541
+ racc_action_default,
542
+ racc_action_pointer,
543
+ racc_goto_table,
544
+ racc_goto_check,
545
+ racc_goto_default,
546
+ racc_goto_pointer,
547
+ racc_nt_base,
548
+ racc_reduce_table,
549
+ racc_token_table,
550
+ racc_shift_n,
551
+ racc_reduce_n,
552
+ racc_use_result_var ]
553
+
554
+ Racc_token_to_s_table = [
555
+ '$end',
556
+ 'error',
557
+ '"*"',
558
+ '"/"',
559
+ '"+"',
560
+ '"-"',
561
+ 'PRAGMA',
562
+ 'INCLUDE',
563
+ 'IDENTIFIER',
564
+ 'CLASS',
565
+ 'ASSOCIATION',
566
+ 'INDICATION',
567
+ 'AMENDED',
568
+ 'ENABLEOVERRIDE',
569
+ 'DISABLEOVERRIDE',
570
+ 'RESTRICTED',
571
+ 'TOSUBCLASS',
572
+ 'TOINSTANCE',
573
+ 'TRANSLATABLE',
574
+ 'QUALIFIER',
575
+ 'SCOPE',
576
+ 'SCHEMA',
577
+ 'PROPERTY',
578
+ 'REFERENCE',
579
+ 'METHOD',
580
+ 'PARAMETER',
581
+ 'FLAVOR',
582
+ 'INSTANCE',
583
+ 'AS',
584
+ 'REF',
585
+ 'ANY',
586
+ 'OF',
587
+ 'DT_VOID',
588
+ 'DT_UINT8',
589
+ 'DT_SINT8',
590
+ 'DT_UINT16',
591
+ 'DT_SINT16',
592
+ 'DT_UINT32',
593
+ 'DT_SINT32',
594
+ 'DT_UINT64',
595
+ 'DT_SINT64',
596
+ 'DT_REAL32',
597
+ 'DT_REAL64',
598
+ 'DT_CHAR16',
599
+ 'DT_STR',
600
+ 'DT_BOOL',
601
+ 'DT_DATETIME',
602
+ 'positiveDecimalValue',
603
+ 'stringValue',
604
+ 'realValue',
605
+ 'charValue',
606
+ 'booleanValue',
607
+ 'nullValue',
608
+ 'binaryValue',
609
+ 'octalValue',
610
+ 'decimalValue',
611
+ 'hexValue',
612
+ '"#"',
613
+ '"("',
614
+ '")"',
615
+ '","',
616
+ '"{"',
617
+ '"}"',
618
+ '";"',
619
+ '"["',
620
+ '"]"',
621
+ '":"',
622
+ '"$"',
623
+ '"="',
624
+ '"."',
625
+ '$start',
626
+ 'mofSpecification',
627
+ 'mofProduction',
628
+ 'compilerDirective',
629
+ 'classDeclaration',
630
+ 'qualifierDeclaration',
631
+ 'instanceDeclaration',
632
+ 'pragmaParameters_opt',
633
+ 'pragmaName',
634
+ 'pragmaParameterValues',
635
+ 'pragmaParameterValue',
636
+ 'string',
637
+ 'integerValue',
638
+ 'qualifierList_opt',
639
+ 'className',
640
+ 'alias_opt',
641
+ 'superClass_opt',
642
+ 'classFeatures',
643
+ 'classFeature',
644
+ 'propertyDeclaration',
645
+ 'methodDeclaration',
646
+ 'referenceDeclaration',
647
+ 'qualifierList',
648
+ 'qualifier',
649
+ 'qualifiers',
650
+ 'qualifierName',
651
+ 'qualifierParameter_opt',
652
+ 'flavor_opt',
653
+ 'qflavors',
654
+ 'flavor',
655
+ 'qualifierParameter',
656
+ 'constantValue',
657
+ 'arrayInitializer',
658
+ 'alias',
659
+ 'superClass',
660
+ 'aliasIdentifier',
661
+ 'dataType',
662
+ 'propertyName',
663
+ 'array_opt',
664
+ 'defaultValue_opt',
665
+ 'objectRef',
666
+ 'referenceName',
667
+ 'methodName',
668
+ 'parameterList_opt',
669
+ 'parameterList',
670
+ 'parameter',
671
+ 'parameters',
672
+ 'typespec',
673
+ 'parameterName',
674
+ 'parameterValue_opt',
675
+ 'array',
676
+ 'defaultValue',
677
+ 'positiveDecimalValue_opt',
678
+ 'initializer',
679
+ 'referenceInitializer',
680
+ 'constantValues',
681
+ 'instance',
682
+ 'objectHandle',
683
+ 'namespace_opt',
684
+ 'modelPath',
685
+ 'namespaceHandle',
686
+ 'keyValuePairList',
687
+ 'keyValuePair',
688
+ 'keyValuePairs',
689
+ 'keyname',
690
+ 'qualifierType',
691
+ 'scope',
692
+ 'defaultFlavor_opt',
693
+ 'defaultFlavor',
694
+ 'metaElements',
695
+ 'metaElement',
696
+ 'flavors',
697
+ 'valueInitializers',
698
+ 'valueInitializer']
699
+
700
+ Racc_debug_parser = true
701
+
702
+ ##### racc system variables end #####
703
+
704
+ # reduce 0 omitted
705
+
706
+ module_eval <<'.,.,', 'lib/mof/parser.y', 37
707
+ def _reduce_1( val, _values, result )
708
+ result = Hash.new
709
+ result
710
+ end
711
+ .,.,
712
+
713
+ module_eval <<'.,.,', 'lib/mof/parser.y', 39
714
+ def _reduce_2( val, _values, result )
715
+ result = { @name => @result }
716
+ result
717
+ end
718
+ .,.,
719
+
720
+ module_eval <<'.,.,', 'lib/mof/parser.y', 43
721
+ def _reduce_3( val, _values, result )
722
+ result = val[0]
723
+ result[@name] = @result
724
+ result
725
+ end
726
+ .,.,
727
+
728
+ # reduce 4 omitted
729
+
730
+ module_eval <<'.,.,', 'lib/mof/parser.y', 51
731
+ def _reduce_5( val, _values, result )
732
+ #puts "Class '#{val[0].name}'"
733
+ @result.classes << val[0]
734
+ result
735
+ end
736
+ .,.,
737
+
738
+ module_eval <<'.,.,', 'lib/mof/parser.y', 55
739
+ def _reduce_6( val, _values, result )
740
+ @result.qualifiers << val[0]
741
+ @qualifiers[val[0].name.downcase] = val[0]
742
+ result
743
+ end
744
+ .,.,
745
+
746
+ module_eval <<'.,.,', 'lib/mof/parser.y', 57
747
+ def _reduce_7( val, _values, result )
748
+ @result.instances << val[0]
749
+ result
750
+ end
751
+ .,.,
752
+
753
+ module_eval <<'.,.,', 'lib/mof/parser.y', 69
754
+ def _reduce_8( val, _values, result )
755
+ raise RbmofError.new(@name,@lineno,@line,"Missing filename after '#pragma include'") unless val[3]
756
+ open val[3], :pragma
757
+ result
758
+ end
759
+ .,.,
760
+
761
+ # reduce 9 omitted
762
+
763
+ module_eval <<'.,.,', 'lib/mof/parser.y', 75
764
+ def _reduce_10( val, _values, result )
765
+ raise StyleError.new(@name,@lineno,@line,"Use '#pragma include' instead of '#include'") unless @style == :wmi
766
+ raise RbmofError.new(@name,@lineno,@line,"Missing filename after '#include'") unless val[2]
767
+ open val[2], :pragma
768
+ result
769
+ end
770
+ .,.,
771
+
772
+ # reduce 11 omitted
773
+
774
+ module_eval <<'.,.,', 'lib/mof/parser.y', 84
775
+ def _reduce_12( val, _values, result )
776
+ raise StyleError.new(@name,@lineno,@line,"#pragma parameter missing") unless @style == :wmi
777
+ result
778
+ end
779
+ .,.,
780
+
781
+ module_eval <<'.,.,', 'lib/mof/parser.y', 86
782
+ def _reduce_13( val, _values, result )
783
+ result = val[1]
784
+ result
785
+ end
786
+ .,.,
787
+
788
+ # reduce 14 omitted
789
+
790
+ # reduce 15 omitted
791
+
792
+ # reduce 16 omitted
793
+
794
+ module_eval <<'.,.,', 'lib/mof/parser.y', 97
795
+ def _reduce_17( val, _values, result )
796
+ raise StyleError.new(@name,@lineno,@line,"#pragma parameter missing") unless @style == :wmi
797
+ result
798
+ end
799
+ .,.,
800
+
801
+ # reduce 18 omitted
802
+
803
+ module_eval <<'.,.,', 'lib/mof/parser.y', 129
804
+ def _reduce_19( val, _values, result )
805
+ qualifiers = val[0]
806
+ features = val[6]
807
+ if qualifiers and qualifiers.include?(:association, :bool)
808
+ # FIXME: 'association' must be first
809
+ # Context:
810
+ #
811
+ # The remaining qualifier list must not include
812
+ # the ASSOCIATION qualifier again. If the
813
+ # association has no super association, then at
814
+ # least two references must be specified! The
815
+ # ASSOCIATION qualifier may be omitted in
816
+ # sub associations.
817
+ result = CIM::Association.new(val[2],qualifiers,val[3],val[4],features)
818
+ elsif qualifiers and qualifiers.include?(:indication, :bool)
819
+ # FIXME: 'indication' must be first
820
+ # FIXME: features must not include references
821
+ result = CIM::Indication.new(val[2],qualifiers,val[3],val[4],features)
822
+ else
823
+ # FIXME: features must not include references
824
+ result = CIM::Class.new(val[2],qualifiers,val[3],val[4],features)
825
+ end
826
+ result
827
+ end
828
+ .,.,
829
+
830
+ # reduce 20 omitted
831
+
832
+ module_eval <<'.,.,', 'lib/mof/parser.y', 135
833
+ def _reduce_21( val, _values, result )
834
+ result = (val[0]||[]) << val[1]
835
+ result
836
+ end
837
+ .,.,
838
+
839
+ # reduce 22 omitted
840
+
841
+ # reduce 23 omitted
842
+
843
+ # reduce 24 omitted
844
+
845
+ # reduce 25 omitted
846
+
847
+ # reduce 26 omitted
848
+
849
+ module_eval <<'.,.,', 'lib/mof/parser.y', 154
850
+ def _reduce_27( val, _values, result )
851
+ result = val[2]
852
+ result.unshift val[1] if val[1]
853
+ result
854
+ end
855
+ .,.,
856
+
857
+ module_eval <<'.,.,', 'lib/mof/parser.y', 159
858
+ def _reduce_28( val, _values, result )
859
+ result = CIM::Qualifiers.new
860
+ result
861
+ end
862
+ .,.,
863
+
864
+ module_eval <<'.,.,', 'lib/mof/parser.y', 163
865
+ def _reduce_29( val, _values, result )
866
+ result = val[0]
867
+ result << val[2] if val[2]
868
+ result
869
+ end
870
+ .,.,
871
+
872
+ module_eval <<'.,.,', 'lib/mof/parser.y', 185
873
+ def _reduce_30( val, _values, result )
874
+ # Get qualifier decl
875
+ qualifier = case val[0]
876
+ when CIM::Qualifier: val[0].definition
877
+ when CIM::QualifierDeclaration: val[0]
878
+ when String: @qualifiers[val[0].downcase]
879
+ else
880
+ nil
881
+ end
882
+ raise RbmofError.new(@name,@lineno,@line,"'#{val[0]}' is not a valid qualifier") unless qualifier
883
+ value = val[1]
884
+ raise RbmofError.new(@name,@lineno,@line,"#{value.inspect} does not match qualifier type '#{qualifier.type}'") unless qualifier.type.matches?(value)||@style == :wmi
885
+ # Don't propagate a boolean 'false'
886
+ if qualifier.type == :bool && value == false
887
+ result = nil
888
+ else
889
+ result = CIM::Qualifier.new(qualifier,value,val[2])
890
+ end
891
+ result
892
+ end
893
+ .,.,
894
+
895
+ # reduce 31 omitted
896
+
897
+ module_eval <<'.,.,', 'lib/mof/parser.y', 191
898
+ def _reduce_32( val, _values, result )
899
+ result = val[1]
900
+ result
901
+ end
902
+ .,.,
903
+
904
+ module_eval <<'.,.,', 'lib/mof/parser.y', 196
905
+ def _reduce_33( val, _values, result )
906
+ result = [ val[0] ]
907
+ result
908
+ end
909
+ .,.,
910
+
911
+ module_eval <<'.,.,', 'lib/mof/parser.y', 198
912
+ def _reduce_34( val, _values, result )
913
+ result = val[0] << val[1]
914
+ result
915
+ end
916
+ .,.,
917
+
918
+ # reduce 35 omitted
919
+
920
+ # reduce 36 omitted
921
+
922
+ module_eval <<'.,.,', 'lib/mof/parser.y', 208
923
+ def _reduce_37( val, _values, result )
924
+ result = val[1]
925
+ result
926
+ end
927
+ .,.,
928
+
929
+ # reduce 38 omitted
930
+
931
+ # reduce 39 omitted
932
+
933
+ # reduce 40 omitted
934
+
935
+ # reduce 41 omitted
936
+
937
+ # reduce 42 omitted
938
+
939
+ # reduce 43 omitted
940
+
941
+ # reduce 44 omitted
942
+
943
+ module_eval <<'.,.,', 'lib/mof/parser.y', 219
944
+ def _reduce_45( val, _values, result )
945
+ case val[0].to_sym
946
+ when :amended, :toinstance
947
+ raise StyleError.new(@name,@lineno,@line,"'#{val[0]}' is not a valid flavor") unless @style == :wmi
948
+ end
949
+ result
950
+ end
951
+ .,.,
952
+
953
+ # reduce 46 omitted
954
+
955
+ # reduce 47 omitted
956
+
957
+ # reduce 48 omitted
958
+
959
+ # reduce 49 omitted
960
+
961
+ module_eval <<'.,.,', 'lib/mof/parser.y', 234
962
+ def _reduce_50( val, _values, result )
963
+ raise ParseError.new("Class name must be prefixed by '<schema>_'") unless val[0].include?("_") || @style == :wmi
964
+ result
965
+ end
966
+ .,.,
967
+
968
+ module_eval <<'.,.,', 'lib/mof/parser.y', 239
969
+ def _reduce_51( val, _values, result )
970
+ result = val[1]
971
+ result
972
+ end
973
+ .,.,
974
+
975
+ module_eval <<'.,.,', 'lib/mof/parser.y', 244
976
+ def _reduce_52( val, _values, result )
977
+ result = val[1]
978
+ result
979
+ end
980
+ .,.,
981
+
982
+ module_eval <<'.,.,', 'lib/mof/parser.y', 249
983
+ def _reduce_53( val, _values, result )
984
+ result = val[1]
985
+ result
986
+ end
987
+ .,.,
988
+
989
+ module_eval <<'.,.,', 'lib/mof/parser.y', 261
990
+ def _reduce_54( val, _values, result )
991
+ if val[3]
992
+ type = CIM::Array.new val[3],val[1]
993
+ else
994
+ type = val[1]
995
+ end
996
+ result = CIM::Property.new(type,val[2],val[0],val[4])
997
+ result
998
+ end
999
+ .,.,
1000
+
1001
+ module_eval <<'.,.,', 'lib/mof/parser.y', 269
1002
+ def _reduce_55( val, _values, result )
1003
+ if val[4]
1004
+ raise StyleError.new(@name,@lineno,@line,"Array not allowed in reference declaration") unless @style == :wmi
1005
+ end
1006
+ result = CIM::Reference.new(val[1],val[2],val[0],val[4])
1007
+ result
1008
+ end
1009
+ .,.,
1010
+
1011
+ module_eval <<'.,.,', 'lib/mof/parser.y', 274
1012
+ def _reduce_56( val, _values, result )
1013
+ result = CIM::Method.new(val[1],val[2],val[0],val[4])
1014
+ result
1015
+ end
1016
+ .,.,
1017
+
1018
+ # reduce 57 omitted
1019
+
1020
+ module_eval <<'.,.,', 'lib/mof/parser.y', 282
1021
+ def _reduce_58( val, _values, result )
1022
+ # tmplprov.mof has 'string Property;'
1023
+ raise StyleError.new(@name,@lineno,@line,"Invalid keyword '#{val[0]}' used for property name") unless @style == :wmi
1024
+ result
1025
+ end
1026
+ .,.,
1027
+
1028
+ # reduce 59 omitted
1029
+
1030
+ module_eval <<'.,.,', 'lib/mof/parser.y', 288
1031
+ def _reduce_60( val, _values, result )
1032
+ result = "Indication"
1033
+ result
1034
+ end
1035
+ .,.,
1036
+
1037
+ # reduce 61 omitted
1038
+
1039
+ # reduce 62 omitted
1040
+
1041
+ # reduce 63 omitted
1042
+
1043
+ # reduce 64 omitted
1044
+
1045
+ # reduce 65 omitted
1046
+
1047
+ # reduce 66 omitted
1048
+
1049
+ # reduce 67 omitted
1050
+
1051
+ # reduce 68 omitted
1052
+
1053
+ # reduce 69 omitted
1054
+
1055
+ # reduce 70 omitted
1056
+
1057
+ # reduce 71 omitted
1058
+
1059
+ # reduce 72 omitted
1060
+
1061
+ # reduce 73 omitted
1062
+
1063
+ # reduce 74 omitted
1064
+
1065
+ # reduce 75 omitted
1066
+
1067
+ module_eval <<'.,.,', 'lib/mof/parser.y', 311
1068
+ def _reduce_76( val, _values, result )
1069
+ raise StyleError.new(@name,@lineno,@line,"'void' is not a valid datatype") unless @style == :wmi
1070
+ result
1071
+ end
1072
+ .,.,
1073
+
1074
+ module_eval <<'.,.,', 'lib/mof/parser.y', 319
1075
+ def _reduce_77( val, _values, result )
1076
+ # WMI uses class names as data types (without REF ?!)
1077
+ raise StyleError.new(@name,@lineno,@line,"Expected 'ref' keyword after classname '#{val[0]}'") unless @style == :wmi
1078
+ result = CIM::ReferenceType.new val[0]
1079
+ result
1080
+ end
1081
+ .,.,
1082
+
1083
+ module_eval <<'.,.,', 'lib/mof/parser.y', 322
1084
+ def _reduce_78( val, _values, result )
1085
+ result = CIM::ReferenceType.new val[0]
1086
+ result
1087
+ end
1088
+ .,.,
1089
+
1090
+ # reduce 79 omitted
1091
+
1092
+ # reduce 80 omitted
1093
+
1094
+ module_eval <<'.,.,', 'lib/mof/parser.y', 332
1095
+ def _reduce_81( val, _values, result )
1096
+ result = (val[1]||[]).unshift val[0]
1097
+ result
1098
+ end
1099
+ .,.,
1100
+
1101
+ # reduce 82 omitted
1102
+
1103
+ module_eval <<'.,.,', 'lib/mof/parser.y', 338
1104
+ def _reduce_83( val, _values, result )
1105
+ result = (val[0]||[]) << val[2]
1106
+ result
1107
+ end
1108
+ .,.,
1109
+
1110
+ module_eval <<'.,.,', 'lib/mof/parser.y', 349
1111
+ def _reduce_84( val, _values, result )
1112
+ if val[3]
1113
+ type = CIM::Array.new val[3], val[1]
1114
+ else
1115
+ type = val[1]
1116
+ end
1117
+ result = CIM::Property.new(type,val[2],val[0])
1118
+ result
1119
+ end
1120
+ .,.,
1121
+
1122
+ # reduce 85 omitted
1123
+
1124
+ # reduce 86 omitted
1125
+
1126
+ # reduce 87 omitted
1127
+
1128
+ # reduce 88 omitted
1129
+
1130
+ # reduce 89 omitted
1131
+
1132
+ # reduce 90 omitted
1133
+
1134
+ module_eval <<'.,.,', 'lib/mof/parser.y', 369
1135
+ def _reduce_91( val, _values, result )
1136
+ raise "Default parameter value not allowed in syntax style '{@style}'" unless @style == :wmi
1137
+ result
1138
+ end
1139
+ .,.,
1140
+
1141
+ module_eval <<'.,.,', 'lib/mof/parser.y', 374
1142
+ def _reduce_92( val, _values, result )
1143
+ result = val[1]
1144
+ result
1145
+ end
1146
+ .,.,
1147
+
1148
+ module_eval <<'.,.,', 'lib/mof/parser.y', 379
1149
+ def _reduce_93( val, _values, result )
1150
+ result = -1
1151
+ result
1152
+ end
1153
+ .,.,
1154
+
1155
+ # reduce 94 omitted
1156
+
1157
+ # reduce 95 omitted
1158
+
1159
+ # reduce 96 omitted
1160
+
1161
+ module_eval <<'.,.,', 'lib/mof/parser.y', 390
1162
+ def _reduce_97( val, _values, result )
1163
+ result = val[1]
1164
+ result
1165
+ end
1166
+ .,.,
1167
+
1168
+ # reduce 98 omitted
1169
+
1170
+ # reduce 99 omitted
1171
+
1172
+ # reduce 100 omitted
1173
+
1174
+ module_eval <<'.,.,', 'lib/mof/parser.y', 401
1175
+ def _reduce_101( val, _values, result )
1176
+ result = val[1]
1177
+ result
1178
+ end
1179
+ .,.,
1180
+
1181
+ # reduce 102 omitted
1182
+
1183
+ module_eval <<'.,.,', 'lib/mof/parser.y', 407
1184
+ def _reduce_103( val, _values, result )
1185
+ result = [ val[0] ]
1186
+ result
1187
+ end
1188
+ .,.,
1189
+
1190
+ module_eval <<'.,.,', 'lib/mof/parser.y', 409
1191
+ def _reduce_104( val, _values, result )
1192
+ result = val[0] << val[2]
1193
+ result
1194
+ end
1195
+ .,.,
1196
+
1197
+ # reduce 105 omitted
1198
+
1199
+ # reduce 106 omitted
1200
+
1201
+ # reduce 107 omitted
1202
+
1203
+ # reduce 108 omitted
1204
+
1205
+ # reduce 109 omitted
1206
+
1207
+ # reduce 110 omitted
1208
+
1209
+ module_eval <<'.,.,', 'lib/mof/parser.y', 420
1210
+ def _reduce_111( val, _values, result )
1211
+ raise "Instance as property value not allowed in syntax style '{@style}'" unless @style == :wmi
1212
+ result
1213
+ end
1214
+ .,.,
1215
+
1216
+ # reduce 112 omitted
1217
+
1218
+ # reduce 113 omitted
1219
+
1220
+ # reduce 114 omitted
1221
+
1222
+ # reduce 115 omitted
1223
+
1224
+ # reduce 116 omitted
1225
+
1226
+ # reduce 117 omitted
1227
+
1228
+ module_eval <<'.,.,', 'lib/mof/parser.y', 434
1229
+ def _reduce_118( val, _values, result )
1230
+ result = val[0] + val[1]
1231
+ result
1232
+ end
1233
+ .,.,
1234
+
1235
+ # reduce 119 omitted
1236
+
1237
+ # reduce 120 omitted
1238
+
1239
+ # reduce 121 omitted
1240
+
1241
+ # reduce 122 omitted
1242
+
1243
+ # reduce 123 omitted
1244
+
1245
+ # reduce 124 omitted
1246
+
1247
+ # reduce 125 omitted
1248
+
1249
+ # reduce 126 omitted
1250
+
1251
+ # reduce 127 omitted
1252
+
1253
+ # reduce 128 omitted
1254
+
1255
+ # reduce 129 omitted
1256
+
1257
+ # reduce 130 omitted
1258
+
1259
+ # reduce 131 omitted
1260
+
1261
+ module_eval <<'.,.,', 'lib/mof/parser.y', 497
1262
+ def _reduce_132( val, _values, result )
1263
+ qname = val[1]
1264
+ if qname.is_a?(CIM::QualifierDeclaration)
1265
+ raise "Wrong default type for #{qname}" unless qname.type.matches?(val[2][0])
1266
+ raise "Wrong default value for #{qname}" unless qname.type.matches?(val[2][1])
1267
+ result = qname
1268
+ else
1269
+ result = CIM::QualifierDeclaration.new( val[1], val[2][0], val[2][1], val[3], val[4])
1270
+ end
1271
+ result
1272
+ end
1273
+ .,.,
1274
+
1275
+ # reduce 133 omitted
1276
+
1277
+ # reduce 134 omitted
1278
+
1279
+ # reduce 135 omitted
1280
+
1281
+ # reduce 136 omitted
1282
+
1283
+ # reduce 137 omitted
1284
+
1285
+ # reduce 138 omitted
1286
+
1287
+ module_eval <<'.,.,', 'lib/mof/parser.y', 517
1288
+ def _reduce_139( val, _values, result )
1289
+ type = val[2].nil? ? val[1] : CIM::Array.new(val[2],val[1])
1290
+ result = [ type, val[3] ]
1291
+ result
1292
+ end
1293
+ .,.,
1294
+
1295
+ module_eval <<'.,.,', 'lib/mof/parser.y', 522
1296
+ def _reduce_140( val, _values, result )
1297
+ result = val[3]
1298
+ result
1299
+ end
1300
+ .,.,
1301
+
1302
+ module_eval <<'.,.,', 'lib/mof/parser.y', 527
1303
+ def _reduce_141( val, _values, result )
1304
+ result = CIM::QualifierScope.new(val[0])
1305
+ result
1306
+ end
1307
+ .,.,
1308
+
1309
+ module_eval <<'.,.,', 'lib/mof/parser.y', 529
1310
+ def _reduce_142( val, _values, result )
1311
+ result = val[0] << CIM::QualifierScope.new(val[2])
1312
+ result
1313
+ end
1314
+ .,.,
1315
+
1316
+ # reduce 143 omitted
1317
+
1318
+ # reduce 144 omitted
1319
+
1320
+ # reduce 145 omitted
1321
+
1322
+ # reduce 146 omitted
1323
+
1324
+ # reduce 147 omitted
1325
+
1326
+ # reduce 148 omitted
1327
+
1328
+ # reduce 149 omitted
1329
+
1330
+ # reduce 150 omitted
1331
+
1332
+ # reduce 151 omitted
1333
+
1334
+ # reduce 152 omitted
1335
+
1336
+ module_eval <<'.,.,', 'lib/mof/parser.y', 547
1337
+ def _reduce_153( val, _values, result )
1338
+ result = val[3]
1339
+ result
1340
+ end
1341
+ .,.,
1342
+
1343
+ module_eval <<'.,.,', 'lib/mof/parser.y', 552
1344
+ def _reduce_154( val, _values, result )
1345
+ result = val[0]
1346
+ result
1347
+ end
1348
+ .,.,
1349
+
1350
+ module_eval <<'.,.,', 'lib/mof/parser.y', 554
1351
+ def _reduce_155( val, _values, result )
1352
+ result = val[0] << val[2]
1353
+ result
1354
+ end
1355
+ .,.,
1356
+
1357
+ # reduce 156 omitted
1358
+
1359
+ # reduce 157 omitted
1360
+
1361
+ # reduce 158 omitted
1362
+
1363
+ # reduce 159 omitted
1364
+
1365
+ # reduce 160 omitted
1366
+
1367
+ module_eval <<'.,.,', 'lib/mof/parser.y', 578
1368
+ def _reduce_161( val, _values, result )
1369
+ raise "Instance property '#{val[1]} must have a value" unless @style == :wmi
1370
+ result
1371
+ end
1372
+ .,.,
1373
+
1374
+ def _reduce_none( val, _values, result )
1375
+ result
1376
+ end
1377
+
1378
+ end # class Parser
1379
+
1380
+ end # module MOF