racc 1.4.13 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +5 -5
  2. data/COPYING +22 -515
  3. data/README.ja.rdoc +3 -4
  4. data/README.rdoc +6 -8
  5. data/Rakefile +30 -53
  6. data/bin/racc +39 -27
  7. data/ext/racc/com/headius/racc/Cparse.java +66 -23
  8. data/ext/racc/{cparse.c → cparse/cparse.c} +78 -47
  9. data/ext/racc/{extconf.rb → cparse/extconf.rb} +2 -1
  10. data/lib/racc/compat.rb +5 -4
  11. data/lib/racc/debugflags.rb +5 -4
  12. data/lib/racc/exception.rb +5 -4
  13. data/lib/racc/grammar.rb +25 -22
  14. data/lib/racc/grammarfileparser.rb +10 -8
  15. data/lib/racc/info.rb +6 -5
  16. data/lib/racc/iset.rb +6 -5
  17. data/lib/racc/logfilegenerator.rb +6 -5
  18. data/lib/racc/parser-text.rb +23 -24
  19. data/lib/racc/parser.rb +23 -24
  20. data/lib/racc/parserfilegenerator.rb +10 -10
  21. data/lib/racc/sourcetext.rb +5 -4
  22. data/lib/racc/state.rb +13 -12
  23. data/lib/racc/statetransitiontable.rb +7 -6
  24. data/rdoc/ja/command.ja.html +1 -1
  25. data/sample/array.y +1 -1
  26. data/sample/array2.y +1 -1
  27. data/sample/calc-ja.y +2 -2
  28. data/sample/calc.y +2 -2
  29. data/sample/conflict.y +1 -1
  30. data/sample/hash.y +1 -1
  31. data/sample/lalr.y +1 -1
  32. data/sample/lists.y +1 -1
  33. data/sample/syntax.y +1 -1
  34. data/sample/yyerr.y +1 -1
  35. data/test/assets/cadenza.y +170 -0
  36. data/test/assets/cast.y +926 -0
  37. data/test/assets/csspool.y +729 -0
  38. data/test/assets/edtf.y +583 -0
  39. data/test/assets/error_recovery.y +35 -0
  40. data/test/assets/huia.y +318 -0
  41. data/test/assets/intp.y +4 -4
  42. data/test/assets/journey.y +47 -0
  43. data/test/assets/liquor.y +313 -0
  44. data/test/assets/machete.y +423 -0
  45. data/test/assets/macruby.y +2197 -0
  46. data/test/assets/mailp.y +27 -27
  47. data/test/assets/mediacloth.y +599 -0
  48. data/test/assets/mof.y +649 -0
  49. data/test/assets/namae.y +302 -0
  50. data/test/assets/nasl.y +626 -0
  51. data/test/assets/nokogiri-css.y +255 -0
  52. data/test/assets/nullbug2.y +2 -2
  53. data/test/assets/opal.y +1807 -0
  54. data/test/assets/php_serialization.y +98 -0
  55. data/test/assets/recv.y +20 -20
  56. data/test/assets/riml.y +665 -0
  57. data/test/assets/ruby18.y +1943 -0
  58. data/test/assets/ruby19.y +2174 -0
  59. data/test/assets/ruby20.y +2350 -0
  60. data/test/assets/ruby21.y +2359 -0
  61. data/test/assets/ruby22.y +2381 -0
  62. data/test/assets/syntax.y +1 -1
  63. data/test/assets/tp_plus.y +622 -0
  64. data/test/assets/twowaysql.y +278 -0
  65. data/test/helper.rb +69 -41
  66. data/test/regress/cadenza +796 -0
  67. data/test/regress/cast +3428 -0
  68. data/test/regress/csspool +2314 -0
  69. data/test/regress/edtf +1794 -0
  70. data/test/regress/huia +1392 -0
  71. data/test/regress/journey +222 -0
  72. data/test/regress/liquor +885 -0
  73. data/test/regress/machete +833 -0
  74. data/test/regress/mediacloth +1463 -0
  75. data/test/regress/mof +1368 -0
  76. data/test/regress/namae +634 -0
  77. data/test/regress/nasl +2058 -0
  78. data/test/regress/nokogiri-css +836 -0
  79. data/test/regress/opal +6431 -0
  80. data/test/regress/php_serialization +336 -0
  81. data/test/regress/riml +3283 -0
  82. data/test/regress/ruby18 +6344 -0
  83. data/test/regress/ruby22 +7460 -0
  84. data/test/regress/tp_plus +1933 -0
  85. data/test/regress/twowaysql +556 -0
  86. data/test/test_chk_y.rb +1 -0
  87. data/test/test_racc_command.rb +186 -2
  88. data/test/test_scan_y.rb +1 -0
  89. data/test/testscanner.rb +1 -1
  90. metadata +60 -83
  91. data/DEPENDS +0 -4
  92. data/Manifest.txt +0 -101
  93. data/bin/racc2y +0 -195
  94. data/bin/y2racc +0 -339
  95. data/ext/racc/depend +0 -1
  96. data/fastcache/extconf.rb +0 -2
  97. data/fastcache/fastcache.c +0 -185
  98. data/misc/dist.sh +0 -31
  99. data/setup.rb +0 -1587
  100. data/tasks/doc.rb +0 -12
  101. data/tasks/email.rb +0 -55
@@ -0,0 +1,649 @@
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 ----