racc 1.5.2 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.ja.rdoc +0 -1
- data/README.rdoc +6 -7
- data/{rdoc → doc}/en/NEWS.en.rdoc +0 -0
- data/{rdoc → doc}/en/grammar.en.rdoc +27 -31
- data/doc/en/grammar2.en.rdoc +219 -0
- data/{rdoc → doc}/ja/NEWS.ja.rdoc +0 -0
- data/{rdoc → doc}/ja/command.ja.html +0 -0
- data/{rdoc → doc}/ja/debug.ja.rdoc +0 -0
- data/{rdoc → doc}/ja/grammar.ja.rdoc +0 -0
- data/{rdoc → doc}/ja/index.ja.html +0 -0
- data/{rdoc → doc}/ja/parser.ja.rdoc +0 -0
- data/{rdoc → doc}/ja/usage.ja.html +0 -0
- data/ext/racc/cparse/cparse.c +1 -1
- data/ext/racc/cparse/extconf.rb +1 -0
- data/lib/racc/info.rb +1 -1
- data/lib/racc/parser-text.rb +1 -1
- data/lib/racc/parser.rb +1 -1
- data/lib/racc/parserfilegenerator.rb +0 -44
- data/lib/racc/statetransitiontable.rb +2 -8
- metadata +15 -121
- data/Rakefile +0 -79
- data/ext/racc/com/headius/racc/Cparse.java +0 -849
- data/lib/racc/pre-setup +0 -13
- data/sample/array.y +0 -67
- data/sample/array2.y +0 -59
- data/sample/calc-ja.y +0 -66
- data/sample/calc.y +0 -65
- data/sample/conflict.y +0 -15
- data/sample/hash.y +0 -60
- data/sample/lalr.y +0 -17
- data/sample/lists.y +0 -57
- data/sample/syntax.y +0 -46
- data/sample/yyerr.y +0 -46
- data/test/assets/cadenza.y +0 -170
- data/test/assets/cast.y +0 -926
- data/test/assets/chk.y +0 -126
- data/test/assets/conf.y +0 -16
- data/test/assets/csspool.y +0 -729
- data/test/assets/digraph.y +0 -29
- data/test/assets/echk.y +0 -118
- data/test/assets/edtf.y +0 -583
- data/test/assets/err.y +0 -60
- data/test/assets/error_recovery.y +0 -35
- data/test/assets/expect.y +0 -7
- data/test/assets/firstline.y +0 -4
- data/test/assets/huia.y +0 -318
- data/test/assets/ichk.y +0 -102
- data/test/assets/intp.y +0 -546
- data/test/assets/journey.y +0 -47
- data/test/assets/liquor.y +0 -313
- data/test/assets/machete.y +0 -423
- data/test/assets/macruby.y +0 -2197
- data/test/assets/mailp.y +0 -437
- data/test/assets/mediacloth.y +0 -599
- data/test/assets/mof.y +0 -649
- data/test/assets/namae.y +0 -302
- data/test/assets/nasl.y +0 -626
- data/test/assets/newsyn.y +0 -25
- data/test/assets/noend.y +0 -4
- data/test/assets/nokogiri-css.y +0 -255
- data/test/assets/nonass.y +0 -41
- data/test/assets/normal.y +0 -27
- data/test/assets/norule.y +0 -4
- data/test/assets/nullbug1.y +0 -25
- data/test/assets/nullbug2.y +0 -15
- data/test/assets/opal.y +0 -1807
- data/test/assets/opt.y +0 -123
- data/test/assets/percent.y +0 -35
- data/test/assets/php_serialization.y +0 -98
- data/test/assets/recv.y +0 -97
- data/test/assets/riml.y +0 -665
- data/test/assets/rrconf.y +0 -14
- data/test/assets/ruby18.y +0 -1943
- data/test/assets/ruby19.y +0 -2174
- data/test/assets/ruby20.y +0 -2350
- data/test/assets/ruby21.y +0 -2359
- data/test/assets/ruby22.y +0 -2381
- data/test/assets/scan.y +0 -72
- data/test/assets/syntax.y +0 -50
- data/test/assets/tp_plus.y +0 -622
- data/test/assets/twowaysql.y +0 -278
- data/test/assets/unterm.y +0 -5
- data/test/assets/useless.y +0 -12
- data/test/assets/yyerr.y +0 -46
- data/test/bench.y +0 -36
- data/test/helper.rb +0 -115
- data/test/infini.y +0 -8
- data/test/regress/cadenza +0 -796
- data/test/regress/cast +0 -3428
- data/test/regress/csspool +0 -2314
- data/test/regress/edtf +0 -1794
- data/test/regress/huia +0 -1392
- data/test/regress/journey +0 -222
- data/test/regress/liquor +0 -885
- data/test/regress/machete +0 -833
- data/test/regress/mediacloth +0 -1463
- data/test/regress/mof +0 -1368
- data/test/regress/namae +0 -634
- data/test/regress/nasl +0 -2058
- data/test/regress/nokogiri-css +0 -836
- data/test/regress/opal +0 -6431
- data/test/regress/php_serialization +0 -336
- data/test/regress/riml +0 -3283
- data/test/regress/ruby18 +0 -6344
- data/test/regress/ruby22 +0 -7460
- data/test/regress/tp_plus +0 -1933
- data/test/regress/twowaysql +0 -556
- data/test/scandata/brace +0 -7
- data/test/scandata/gvar +0 -1
- data/test/scandata/normal +0 -4
- data/test/scandata/percent +0 -18
- data/test/scandata/slash +0 -10
- data/test/src.intp +0 -34
- data/test/start.y +0 -20
- data/test/test_chk_y.rb +0 -52
- data/test/test_grammar_file_parser.rb +0 -15
- data/test/test_racc_command.rb +0 -339
- data/test/test_scan_y.rb +0 -52
- data/test/testscanner.rb +0 -51
- data/web/racc.en.rhtml +0 -42
- data/web/racc.ja.rhtml +0 -51
data/test/assets/mof.y
DELETED
@@ -1,649 +0,0 @@
|
|
1
|
-
# Distributed under the Ruby license
|
2
|
-
# See http://www.ruby-lang.org/en/LICENSE.txt for the full license text
|
3
|
-
# Copyright (c) 2010 Klaus Kämpf <kkaempf@suse.de>
|
4
|
-
|
5
|
-
/*
|
6
|
-
* According to appendix A of
|
7
|
-
* http://www.dmtf.org/standards/cim/cim_spec_v22
|
8
|
-
*/
|
9
|
-
|
10
|
-
class MOF::Parser
|
11
|
-
prechigh
|
12
|
-
/* nonassoc UMINUS */
|
13
|
-
left '*' '/'
|
14
|
-
left '+' '-'
|
15
|
-
preclow
|
16
|
-
|
17
|
-
token PRAGMA INCLUDE IDENTIFIER CLASS ASSOCIATION INDICATION
|
18
|
-
AMENDED ENABLEOVERRIDE DISABLEOVERRIDE RESTRICTED TOSUBCLASS TOINSTANCE
|
19
|
-
TRANSLATABLE QUALIFIER SCOPE SCHEMA PROPERTY REFERENCE
|
20
|
-
METHOD PARAMETER FLAVOR INSTANCE
|
21
|
-
AS REF ANY OF
|
22
|
-
DT_VOID
|
23
|
-
DT_UINT8 DT_SINT8 DT_UINT16 DT_SINT16 DT_UINT32 DT_SINT32
|
24
|
-
DT_UINT64 DT_SINT64 DT_REAL32 DT_REAL64 DT_CHAR16 DT_STR
|
25
|
-
DT_BOOLEAN DT_DATETIME
|
26
|
-
positiveDecimalValue
|
27
|
-
stringValue
|
28
|
-
realValue
|
29
|
-
charValue
|
30
|
-
booleanValue
|
31
|
-
nullValue
|
32
|
-
binaryValue
|
33
|
-
octalValue
|
34
|
-
decimalValue
|
35
|
-
hexValue
|
36
|
-
|
37
|
-
rule
|
38
|
-
|
39
|
-
/* Returns a Hash of filename and MofResult */
|
40
|
-
mofSpecification
|
41
|
-
: /* empty */
|
42
|
-
{ result = Hash.new }
|
43
|
-
| mofProduction
|
44
|
-
{ result = { @name => @result } }
|
45
|
-
| mofSpecification mofProduction
|
46
|
-
{ result = val[0]
|
47
|
-
result[@name] = @result
|
48
|
-
}
|
49
|
-
;
|
50
|
-
|
51
|
-
mofProduction
|
52
|
-
: compilerDirective
|
53
|
-
| classDeclaration
|
54
|
-
{ #puts "Class '#{val[0].name}'"
|
55
|
-
@result.classes << val[0]
|
56
|
-
}
|
57
|
-
| qualifierDeclaration
|
58
|
-
{ @result.qualifiers << val[0]
|
59
|
-
@qualifiers[val[0].name.downcase] = val[0]
|
60
|
-
}
|
61
|
-
| instanceDeclaration
|
62
|
-
{ @result.instances << val[0] }
|
63
|
-
;
|
64
|
-
|
65
|
-
/***
|
66
|
-
* compilerDirective
|
67
|
-
*
|
68
|
-
*/
|
69
|
-
|
70
|
-
compilerDirective
|
71
|
-
: "#" PRAGMA INCLUDE pragmaParameters_opt
|
72
|
-
{ raise MOF::Helper::Error.new(@name,@lineno,@line,"Missing filename after '#pragma include'") unless val[3]
|
73
|
-
open val[3], :pragma
|
74
|
-
}
|
75
|
-
| "#" PRAGMA pragmaName pragmaParameters_opt
|
76
|
-
| "#" INCLUDE pragmaParameters_opt
|
77
|
-
{ raise StyleError.new(@name,@lineno,@line,"Use '#pragma include' instead of '#include'") unless @style == :wmi
|
78
|
-
raise MOF::Helper::Error.new(@name,@lineno,@line,"Missing filename after '#include'") unless val[2]
|
79
|
-
open val[2], :pragma
|
80
|
-
}
|
81
|
-
;
|
82
|
-
|
83
|
-
pragmaName
|
84
|
-
: IDENTIFIER
|
85
|
-
;
|
86
|
-
|
87
|
-
pragmaParameters_opt
|
88
|
-
: /* empty */
|
89
|
-
{ raise StyleError.new(@name,@lineno,@line,"#pragma parameter missing") unless @style == :wmi }
|
90
|
-
| "(" pragmaParameterValues ")"
|
91
|
-
{ result = val[1] }
|
92
|
-
;
|
93
|
-
|
94
|
-
pragmaParameterValues
|
95
|
-
: pragmaParameterValue
|
96
|
-
| pragmaParameterValues "," pragmaParameterValue
|
97
|
-
;
|
98
|
-
|
99
|
-
pragmaParameterValue
|
100
|
-
: string
|
101
|
-
| integerValue
|
102
|
-
{ raise StyleError.new(@name,@lineno,@line,"#pragma parameter missing") unless @style == :wmi }
|
103
|
-
| IDENTIFIER
|
104
|
-
;
|
105
|
-
|
106
|
-
/***
|
107
|
-
* classDeclaration
|
108
|
-
*
|
109
|
-
*/
|
110
|
-
|
111
|
-
classDeclaration
|
112
|
-
: qualifierList_opt CLASS className alias_opt superClass_opt "{" classFeatures "}" ";"
|
113
|
-
{ qualifiers = val[0]
|
114
|
-
features = val[6]
|
115
|
-
# FIXME: features must not include references
|
116
|
-
result = CIM::Class.new(val[2],qualifiers,val[3],val[4],features)
|
117
|
-
}
|
118
|
-
;
|
119
|
-
|
120
|
-
classFeatures
|
121
|
-
: /* empty */
|
122
|
-
{ result = [] }
|
123
|
-
| classFeatures classFeature
|
124
|
-
{ result = val[0] << val[1] }
|
125
|
-
;
|
126
|
-
|
127
|
-
classFeature
|
128
|
-
: propertyDeclaration
|
129
|
-
| methodDeclaration
|
130
|
-
| referenceDeclaration /* must have association qualifier */
|
131
|
-
;
|
132
|
-
|
133
|
-
|
134
|
-
qualifierList_opt
|
135
|
-
: /* empty */
|
136
|
-
| qualifierList
|
137
|
-
{ result = CIM::QualifierSet.new val[0] }
|
138
|
-
;
|
139
|
-
|
140
|
-
qualifierList
|
141
|
-
: "[" qualifier qualifiers "]"
|
142
|
-
{ result = val[2]
|
143
|
-
result.unshift val[1] if val[1] }
|
144
|
-
;
|
145
|
-
|
146
|
-
qualifiers
|
147
|
-
: /* empty */
|
148
|
-
{ result = [] }
|
149
|
-
| qualifiers "," qualifier
|
150
|
-
{ result = val[0]
|
151
|
-
result << val[2] if val[2]
|
152
|
-
}
|
153
|
-
;
|
154
|
-
|
155
|
-
qualifier
|
156
|
-
: qualifierName qualifierParameter_opt flavor_opt
|
157
|
-
{ # Get qualifier decl
|
158
|
-
qualifier = case val[0]
|
159
|
-
when CIM::Qualifier then val[0].definition
|
160
|
-
when CIM::QualifierDeclaration then val[0]
|
161
|
-
when String then @qualifiers[val[0].downcase]
|
162
|
-
else
|
163
|
-
nil
|
164
|
-
end
|
165
|
-
raise MOF::Helper::Error.new(@name,@lineno,@line,"'#{val[0]}' is not a valid qualifier") unless qualifier
|
166
|
-
value = val[1]
|
167
|
-
raise MOF::Helper::Error.new(@name,@lineno,@line,"#{value.inspect} does not match qualifier type '#{qualifier.type}'") unless qualifier.type.matches?(value)||@style == :wmi
|
168
|
-
# Don't propagate a boolean 'false'
|
169
|
-
if qualifier.type == :boolean && value == false
|
170
|
-
result = nil
|
171
|
-
else
|
172
|
-
result = CIM::Qualifier.new(qualifier,value,val[2])
|
173
|
-
end
|
174
|
-
}
|
175
|
-
;
|
176
|
-
|
177
|
-
flavor_opt
|
178
|
-
: /* empty */
|
179
|
-
| ":" flavor
|
180
|
-
{ result = CIM::QualifierFlavors.new val[1] }
|
181
|
-
;
|
182
|
-
|
183
|
-
qualifierParameter_opt
|
184
|
-
: /* empty */
|
185
|
-
| qualifierParameter
|
186
|
-
;
|
187
|
-
|
188
|
-
qualifierParameter
|
189
|
-
: "(" constantValue ")"
|
190
|
-
{ result = val[1] }
|
191
|
-
| arrayInitializer
|
192
|
-
;
|
193
|
-
|
194
|
-
/* CIM::Flavors */
|
195
|
-
flavor
|
196
|
-
: AMENDED | ENABLEOVERRIDE | DISABLEOVERRIDE | RESTRICTED | TOSUBCLASS | TRANSLATABLE | TOINSTANCE
|
197
|
-
{ case val[0].to_sym
|
198
|
-
when :amended, :toinstance
|
199
|
-
raise StyleError.new(@name,@lineno,@line,"'#{val[0]}' is not a valid flavor") unless @style == :wmi
|
200
|
-
end
|
201
|
-
}
|
202
|
-
;
|
203
|
-
|
204
|
-
alias_opt
|
205
|
-
: /* empty */
|
206
|
-
| alias
|
207
|
-
;
|
208
|
-
|
209
|
-
superClass_opt
|
210
|
-
: /* empty */
|
211
|
-
| superClass
|
212
|
-
;
|
213
|
-
|
214
|
-
className
|
215
|
-
: IDENTIFIER /* must be <schema>_<classname> in CIM v2.x */
|
216
|
-
{ raise ParseError.new("Class name must be prefixed by '<schema>_'") unless val[0].include?("_") || @style == :wmi }
|
217
|
-
;
|
218
|
-
|
219
|
-
alias
|
220
|
-
: AS aliasIdentifier
|
221
|
-
{ result = val[1] }
|
222
|
-
;
|
223
|
-
|
224
|
-
aliasIdentifier
|
225
|
-
: "$" IDENTIFIER /* NO whitespace ! */
|
226
|
-
{ result = val[1] }
|
227
|
-
;
|
228
|
-
|
229
|
-
superClass
|
230
|
-
: ":" className
|
231
|
-
{ result = val[1] }
|
232
|
-
;
|
233
|
-
|
234
|
-
|
235
|
-
propertyDeclaration
|
236
|
-
: qualifierList_opt dataType propertyName array_opt defaultValue_opt ";"
|
237
|
-
{ if val[3]
|
238
|
-
type = CIM::Array.new val[3],val[1]
|
239
|
-
else
|
240
|
-
type = val[1]
|
241
|
-
end
|
242
|
-
result = CIM::Property.new(type,val[2],val[0],val[4])
|
243
|
-
}
|
244
|
-
;
|
245
|
-
|
246
|
-
referenceDeclaration
|
247
|
-
: qualifierList_opt objectRef referenceName array_opt defaultValue_opt ";"
|
248
|
-
{ if val[4]
|
249
|
-
raise StyleError.new(@name,@lineno,@line,"Array not allowed in reference declaration") unless @style == :wmi
|
250
|
-
end
|
251
|
-
result = CIM::Reference.new(val[1],val[2],val[0],val[4]) }
|
252
|
-
;
|
253
|
-
|
254
|
-
methodDeclaration
|
255
|
-
: qualifierList_opt dataType methodName "(" parameterList_opt ")" ";"
|
256
|
-
{ result = CIM::Method.new(val[1],val[2],val[0],val[4]) }
|
257
|
-
;
|
258
|
-
|
259
|
-
propertyName
|
260
|
-
: IDENTIFIER
|
261
|
-
| PROPERTY
|
262
|
-
{ # tmplprov.mof has 'string Property;'
|
263
|
-
raise StyleError.new(@name,@lineno,@line,"Invalid keyword '#{val[0]}' used for property name") unless @style == :wmi
|
264
|
-
}
|
265
|
-
;
|
266
|
-
|
267
|
-
referenceName
|
268
|
-
: IDENTIFIER
|
269
|
-
| INDICATION
|
270
|
-
{ result = "Indication" }
|
271
|
-
;
|
272
|
-
|
273
|
-
methodName
|
274
|
-
: IDENTIFIER
|
275
|
-
;
|
276
|
-
|
277
|
-
dataType
|
278
|
-
: DT_UINT8
|
279
|
-
| DT_SINT8
|
280
|
-
| DT_UINT16
|
281
|
-
| DT_SINT16
|
282
|
-
| DT_UINT32
|
283
|
-
| DT_SINT32
|
284
|
-
| DT_UINT64
|
285
|
-
| DT_SINT64
|
286
|
-
| DT_REAL32
|
287
|
-
| DT_REAL64
|
288
|
-
| DT_CHAR16
|
289
|
-
| DT_STR
|
290
|
-
| DT_BOOLEAN
|
291
|
-
| DT_DATETIME
|
292
|
-
| DT_VOID
|
293
|
-
{ raise StyleError.new(@name,@lineno,@line,"'void' is not a valid datatype") unless @style == :wmi }
|
294
|
-
;
|
295
|
-
|
296
|
-
objectRef
|
297
|
-
: className
|
298
|
-
{ # WMI uses class names as data types (without REF ?!)
|
299
|
-
raise StyleError.new(@name,@lineno,@line,"Expected 'ref' keyword after classname '#{val[0]}'") unless @style == :wmi
|
300
|
-
result = CIM::ReferenceType.new val[0]
|
301
|
-
}
|
302
|
-
|
303
|
-
| className REF
|
304
|
-
{ result = CIM::ReferenceType.new val[0] }
|
305
|
-
;
|
306
|
-
|
307
|
-
parameterList_opt
|
308
|
-
: /* empty */
|
309
|
-
| parameterList
|
310
|
-
;
|
311
|
-
|
312
|
-
parameterList
|
313
|
-
: parameter parameters
|
314
|
-
{ result = val[1].unshift val[0] }
|
315
|
-
;
|
316
|
-
|
317
|
-
parameters
|
318
|
-
: /* empty */
|
319
|
-
{ result = [] }
|
320
|
-
| parameters "," parameter
|
321
|
-
{ result = val[0] << val[2] }
|
322
|
-
;
|
323
|
-
|
324
|
-
parameter
|
325
|
-
: qualifierList_opt typespec parameterName array_opt parameterValue_opt
|
326
|
-
{ if val[3]
|
327
|
-
type = CIM::Array.new val[3], val[1]
|
328
|
-
else
|
329
|
-
type = val[1]
|
330
|
-
end
|
331
|
-
result = CIM::Property.new(type,val[2],val[0])
|
332
|
-
}
|
333
|
-
;
|
334
|
-
|
335
|
-
typespec
|
336
|
-
: dataType
|
337
|
-
| objectRef
|
338
|
-
;
|
339
|
-
|
340
|
-
parameterName
|
341
|
-
: IDENTIFIER
|
342
|
-
;
|
343
|
-
|
344
|
-
array_opt
|
345
|
-
: /* empty */
|
346
|
-
| array
|
347
|
-
;
|
348
|
-
|
349
|
-
parameterValue_opt
|
350
|
-
: /* empty */
|
351
|
-
| defaultValue
|
352
|
-
{ raise "Default parameter value not allowed in syntax style '{@style}'" unless @style == :wmi }
|
353
|
-
;
|
354
|
-
|
355
|
-
array
|
356
|
-
: "[" positiveDecimalValue_opt "]"
|
357
|
-
{ result = val[1] }
|
358
|
-
;
|
359
|
-
|
360
|
-
positiveDecimalValue_opt
|
361
|
-
: /* empty */
|
362
|
-
{ result = -1 }
|
363
|
-
| positiveDecimalValue
|
364
|
-
;
|
365
|
-
|
366
|
-
defaultValue_opt
|
367
|
-
: /* empty */
|
368
|
-
| defaultValue
|
369
|
-
;
|
370
|
-
|
371
|
-
defaultValue
|
372
|
-
: "=" initializer
|
373
|
-
{ result = val[1] }
|
374
|
-
;
|
375
|
-
|
376
|
-
initializer
|
377
|
-
: constantValue
|
378
|
-
| arrayInitializer
|
379
|
-
| referenceInitializer
|
380
|
-
;
|
381
|
-
|
382
|
-
arrayInitializer
|
383
|
-
: "{" constantValues "}"
|
384
|
-
{ result = val[1] }
|
385
|
-
;
|
386
|
-
|
387
|
-
constantValues
|
388
|
-
: /* empty */
|
389
|
-
| constantValue
|
390
|
-
{ result = [ val[0] ] }
|
391
|
-
| constantValues "," constantValue
|
392
|
-
{ result = val[0] << val[2] }
|
393
|
-
;
|
394
|
-
|
395
|
-
constantValue
|
396
|
-
: integerValue
|
397
|
-
| realValue
|
398
|
-
| charValue
|
399
|
-
| string
|
400
|
-
| booleanValue
|
401
|
-
| nullValue
|
402
|
-
| instance
|
403
|
-
{ raise "Instance as property value not allowed in syntax style '{@style}'" unless @style == :wmi }
|
404
|
-
;
|
405
|
-
|
406
|
-
integerValue
|
407
|
-
: binaryValue
|
408
|
-
| octalValue
|
409
|
-
| decimalValue
|
410
|
-
| positiveDecimalValue
|
411
|
-
| hexValue
|
412
|
-
;
|
413
|
-
|
414
|
-
string
|
415
|
-
: stringValue
|
416
|
-
| string stringValue
|
417
|
-
{ result = val[0] + val[1] }
|
418
|
-
;
|
419
|
-
|
420
|
-
referenceInitializer
|
421
|
-
: objectHandle
|
422
|
-
| aliasIdentifier
|
423
|
-
;
|
424
|
-
|
425
|
-
objectHandle
|
426
|
-
: namespace_opt modelPath
|
427
|
-
;
|
428
|
-
|
429
|
-
namespace_opt
|
430
|
-
: /* empty */
|
431
|
-
| namespaceHandle ":"
|
432
|
-
;
|
433
|
-
|
434
|
-
namespaceHandle
|
435
|
-
: IDENTIFIER
|
436
|
-
;
|
437
|
-
|
438
|
-
/*
|
439
|
-
* Note
|
440
|
-
: structure depends on type of namespace
|
441
|
-
*/
|
442
|
-
|
443
|
-
modelPath
|
444
|
-
: className "." keyValuePairList
|
445
|
-
;
|
446
|
-
|
447
|
-
keyValuePairList
|
448
|
-
: keyValuePair keyValuePairs
|
449
|
-
;
|
450
|
-
|
451
|
-
keyValuePairs
|
452
|
-
: /* empty */
|
453
|
-
| keyValuePairs "," keyValuePair
|
454
|
-
;
|
455
|
-
|
456
|
-
keyValuePair
|
457
|
-
: keyname "=" initializer
|
458
|
-
;
|
459
|
-
|
460
|
-
keyname
|
461
|
-
: propertyName | referenceName
|
462
|
-
;
|
463
|
-
|
464
|
-
/***
|
465
|
-
* qualifierDeclaration
|
466
|
-
*
|
467
|
-
*/
|
468
|
-
|
469
|
-
qualifierDeclaration
|
470
|
-
/* 0 1 2 3 4 */
|
471
|
-
: QUALIFIER qualifierName qualifierType scope defaultFlavor_opt ";"
|
472
|
-
{ result = CIM::QualifierDeclaration.new( val[1], val[2][0], val[2][1], val[3], val[4]) }
|
473
|
-
;
|
474
|
-
|
475
|
-
defaultFlavor_opt
|
476
|
-
: /* empty */
|
477
|
-
| defaultFlavor
|
478
|
-
;
|
479
|
-
|
480
|
-
qualifierName
|
481
|
-
: IDENTIFIER
|
482
|
-
| ASSOCIATION /* meta qualifier */
|
483
|
-
| INDICATION /* meta qualifier */
|
484
|
-
| REFERENCE /* Added in DSP0004 2.7.0 */
|
485
|
-
| SCHEMA
|
486
|
-
;
|
487
|
-
|
488
|
-
/* [type, value] */
|
489
|
-
qualifierType
|
490
|
-
: ":" dataType array_opt defaultValue_opt
|
491
|
-
{ type = val[2].nil? ? val[1] : CIM::Array.new(val[2],val[1])
|
492
|
-
result = [ type, val[3] ]
|
493
|
-
}
|
494
|
-
;
|
495
|
-
|
496
|
-
scope
|
497
|
-
: "," SCOPE "(" metaElements ")"
|
498
|
-
{ result = CIM::QualifierScopes.new(val[3]) }
|
499
|
-
;
|
500
|
-
|
501
|
-
metaElements
|
502
|
-
: metaElement
|
503
|
-
{ result = [ val[0] ] }
|
504
|
-
| metaElements "," metaElement
|
505
|
-
{ result = val[0] << val[2] }
|
506
|
-
;
|
507
|
-
|
508
|
-
metaElement
|
509
|
-
: SCHEMA
|
510
|
-
| CLASS
|
511
|
-
| ASSOCIATION
|
512
|
-
| INDICATION
|
513
|
-
| QUALIFIER
|
514
|
-
| PROPERTY
|
515
|
-
| REFERENCE
|
516
|
-
| METHOD
|
517
|
-
| PARAMETER
|
518
|
-
| ANY
|
519
|
-
;
|
520
|
-
|
521
|
-
defaultFlavor
|
522
|
-
: "," FLAVOR "(" flavors ")"
|
523
|
-
{ result = CIM::QualifierFlavors.new val[3] }
|
524
|
-
;
|
525
|
-
|
526
|
-
flavors
|
527
|
-
: flavor
|
528
|
-
{ result = [ val[0] ] }
|
529
|
-
| flavors "," flavor
|
530
|
-
{ result = val[0] << val[2] }
|
531
|
-
;
|
532
|
-
|
533
|
-
/***
|
534
|
-
* instanceDeclaration
|
535
|
-
*
|
536
|
-
*/
|
537
|
-
|
538
|
-
instanceDeclaration
|
539
|
-
: instance ";"
|
540
|
-
;
|
541
|
-
|
542
|
-
instance
|
543
|
-
: qualifierList_opt INSTANCE OF className alias_opt "{" valueInitializers "}"
|
544
|
-
;
|
545
|
-
|
546
|
-
valueInitializers
|
547
|
-
: valueInitializer
|
548
|
-
| valueInitializers valueInitializer
|
549
|
-
;
|
550
|
-
|
551
|
-
valueInitializer
|
552
|
-
: qualifierList_opt keyname "=" initializer ";"
|
553
|
-
| qualifierList_opt keyname ";"
|
554
|
-
{ raise "Instance property '#{val[1]} must have a value" unless @style == :wmi }
|
555
|
-
;
|
556
|
-
|
557
|
-
end # class Parser
|
558
|
-
|
559
|
-
---- header ----
|
560
|
-
|
561
|
-
# parser.rb - generated by racc
|
562
|
-
|
563
|
-
require 'strscan'
|
564
|
-
require 'rubygems'
|
565
|
-
require 'cim'
|
566
|
-
require File.join(File.dirname(__FILE__), 'result')
|
567
|
-
require File.join(File.dirname(__FILE__), 'scanner')
|
568
|
-
require File.join(File.dirname(__FILE__), 'helper')
|
569
|
-
|
570
|
-
---- inner ----
|
571
|
-
|
572
|
-
#
|
573
|
-
# Initialize MOF::Parser
|
574
|
-
# MOF::Parser.new options = {}
|
575
|
-
#
|
576
|
-
# options -> Hash of options
|
577
|
-
# :debug -> boolean
|
578
|
-
# :includes -> array of include dirs
|
579
|
-
# :style -> :cim or :wmi
|
580
|
-
#
|
581
|
-
def initialize options = {}
|
582
|
-
@yydebug = options[:debug]
|
583
|
-
@includes = options[:includes] || []
|
584
|
-
@quiet = options[:quiet]
|
585
|
-
@style = options[:style] || :cim # default to style CIM v2.2 syntax
|
586
|
-
|
587
|
-
@lineno = 1
|
588
|
-
@file = nil
|
589
|
-
@iconv = nil
|
590
|
-
@eol = "\n"
|
591
|
-
@fname = nil
|
592
|
-
@fstack = []
|
593
|
-
@in_comment = false
|
594
|
-
@seen_files = []
|
595
|
-
@qualifiers = {}
|
596
|
-
end
|
597
|
-
|
598
|
-
#
|
599
|
-
# Make options hash from argv
|
600
|
-
#
|
601
|
-
# returns [ files, options ]
|
602
|
-
#
|
603
|
-
|
604
|
-
def self.argv_handler name, argv
|
605
|
-
files = []
|
606
|
-
options = { :namespace => "" }
|
607
|
-
while argv.size > 0
|
608
|
-
case opt = argv.shift
|
609
|
-
when "-h"
|
610
|
-
$stderr.puts "Ruby MOF compiler"
|
611
|
-
$stderr.puts "#{name} [-h] [-d] [-I <dir>] [<moffiles>]"
|
612
|
-
$stderr.puts "Compiles <moffile>"
|
613
|
-
$stderr.puts "\t-d debug"
|
614
|
-
$stderr.puts "\t-h this help"
|
615
|
-
$stderr.puts "\t-I <dir> include dir"
|
616
|
-
$stderr.puts "\t-f force"
|
617
|
-
$stderr.puts "\t-n <namespace>"
|
618
|
-
$stderr.puts "\t-o <output>"
|
619
|
-
$stderr.puts "\t-s <style> syntax style (wmi,cim)"
|
620
|
-
$stderr.puts "\t-q quiet"
|
621
|
-
$stderr.puts "\t<moffiles> file(s) to read (else use $stdin)"
|
622
|
-
exit 0
|
623
|
-
when "-f" then options[:force] = true
|
624
|
-
when "-s" then options[:style] = argv.shift.to_sym
|
625
|
-
when "-d" then options[:debug] = true
|
626
|
-
when "-q" then options[:quiet] = true
|
627
|
-
when "-I"
|
628
|
-
options[:includes] ||= []
|
629
|
-
dirname = argv.shift
|
630
|
-
unless File.directory?(dirname)
|
631
|
-
files << dirname
|
632
|
-
dirname = File.dirname(dirname)
|
633
|
-
end
|
634
|
-
options[:includes] << Pathname.new(dirname)
|
635
|
-
when "-n" then options[:namespace] = argv.shift
|
636
|
-
when "-o" then options[:output] = argv.shift
|
637
|
-
when /^-.+/
|
638
|
-
$stderr.puts "Undefined option #{opt}"
|
639
|
-
else
|
640
|
-
files << opt
|
641
|
-
end
|
642
|
-
end
|
643
|
-
[ files, options ]
|
644
|
-
end
|
645
|
-
|
646
|
-
include Helper
|
647
|
-
include Scanner
|
648
|
-
|
649
|
-
---- footer ----
|