rgen 0.5.4 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +28 -0
- data/Rakefile +3 -4
- data/lib/ea_support/uml13_ea_metamodel.rb +3 -3
- data/lib/ea_support/uml13_ea_to_uml13.rb +33 -2
- data/lib/ea_support/uml13_to_uml13_ea.rb +7 -0
- data/lib/mmgen/mm_ext/ecore_mmgen_ext.rb +4 -4
- data/lib/mmgen/templates/metamodel_generator.tpl +143 -143
- data/lib/rgen/ecore/ecore.rb +11 -1
- data/lib/rgen/ecore/ecore_interface.rb +47 -0
- data/lib/rgen/ecore/ecore_to_ruby.rb +166 -0
- data/lib/rgen/ecore/{ecore_transformer.rb → ruby_to_ecore.rb} +11 -11
- data/lib/rgen/environment.rb +15 -2
- data/lib/rgen/fragment/dump_file_cache.rb +63 -0
- data/lib/rgen/fragment/fragmented_model.rb +139 -0
- data/lib/rgen/fragment/model_fragment.rb +268 -0
- data/lib/rgen/instantiator/abstract_xml_instantiator.rb +44 -72
- data/lib/rgen/instantiator/default_xml_instantiator.rb +2 -2
- data/lib/rgen/instantiator/ecore_xml_instantiator.rb +16 -1
- data/lib/rgen/instantiator/json_instantiator.rb +16 -2
- data/lib/rgen/instantiator/nodebased_xml_instantiator.rb +118 -138
- data/lib/rgen/instantiator/qualified_name_resolver.rb +5 -1
- data/lib/rgen/instantiator/reference_resolver.rb +126 -24
- data/lib/rgen/instantiator/xmi11_instantiator.rb +6 -2
- data/lib/rgen/metamodel_builder.rb +18 -6
- data/lib/rgen/metamodel_builder/builder_extensions.rb +431 -407
- data/lib/rgen/metamodel_builder/builder_runtime.rb +8 -8
- data/lib/rgen/metamodel_builder/constant_order_helper.rb +4 -4
- data/lib/rgen/metamodel_builder/data_types.rb +5 -1
- data/lib/rgen/metamodel_builder/intermediate/feature.rb +167 -0
- data/lib/rgen/metamodel_builder/module_extension.rb +2 -2
- data/lib/rgen/model_builder.rb +10 -5
- data/lib/rgen/model_builder/builder_context.rb +17 -1
- data/lib/rgen/serializer/opposite_reference_filter.rb +18 -0
- data/lib/rgen/serializer/qualified_name_provider.rb +45 -0
- data/lib/rgen/template_language/template_container.rb +3 -1
- data/lib/rgen/{auto_class_creator.rb → util/auto_class_creator.rb} +6 -1
- data/lib/rgen/util/cached_glob.rb +67 -0
- data/lib/rgen/util/file_cache_map.rb +104 -0
- data/lib/rgen/util/file_change_detector.rb +78 -0
- data/lib/rgen/{method_delegation.rb → util/method_delegation.rb} +18 -3
- data/lib/rgen/{model_comparator.rb → util/model_comparator.rb} +17 -5
- data/lib/rgen/{model_comparator_base.rb → util/model_comparator_base.rb} +6 -1
- data/lib/rgen/{model_dumper.rb → util/model_dumper.rb} +6 -1
- data/lib/rgen/{name_helper.rb → util/name_helper.rb} +6 -1
- data/lib/rgen/util/pattern_matcher.rb +329 -0
- data/lib/transformers/uml13_to_ecore.rb +103 -60
- data/test/ecore_self_test.rb +43 -42
- data/test/json_test.rb +15 -0
- data/test/metamodel_builder_test.rb +361 -206
- data/test/metamodel_from_ecore_test.rb +45 -0
- data/test/metamodel_order_test.rb +10 -4
- data/test/metamodel_roundtrip_test.rb +2 -2
- data/test/metamodel_roundtrip_test/TestModel_Regenerated.rb +1 -1
- data/test/metamodel_roundtrip_test/houseMetamodel_Regenerated.ecore +50 -50
- data/test/method_delegation_test.rb +9 -9
- data/test/model_builder/ecore_internal.rb +19 -9
- data/test/model_builder/serializer_test.rb +1 -1
- data/test/reference_resolver_test.rb +79 -12
- data/test/rgen_test.rb +2 -0
- data/test/template_language_test.rb +7 -0
- data/test/template_language_test/templates/callback_indent_test/a.tpl +12 -0
- data/test/template_language_test/templates/callback_indent_test/b.tpl +5 -0
- data/test/testmodel/ea_testmodel_regenerated.xml +588 -583
- data/test/transformer_test.rb +3 -3
- data/test/util/file_cache_map_test.rb +91 -0
- data/test/util/file_cache_map_test/testdir/fileA +1 -0
- data/test/util_test.rb +4 -0
- data/test/xml_instantiator_test.rb +139 -135
- metadata +49 -104
- data/lib/rgen/ecore/ecore_instantiator.rb +0 -31
- data/lib/rgen/metamodel_builder/metamodel_description.rb +0 -232
- data/redist/xmlscan/ChangeLog +0 -1301
- data/redist/xmlscan/README +0 -34
- data/redist/xmlscan/THANKS +0 -11
- data/redist/xmlscan/doc/changes.html +0 -74
- data/redist/xmlscan/doc/changes.rd +0 -80
- data/redist/xmlscan/doc/en/conformance.html +0 -136
- data/redist/xmlscan/doc/en/conformance.rd +0 -152
- data/redist/xmlscan/doc/en/manual.html +0 -356
- data/redist/xmlscan/doc/en/manual.rd +0 -402
- data/redist/xmlscan/doc/ja/conformance.ja.html +0 -118
- data/redist/xmlscan/doc/ja/conformance.ja.rd +0 -134
- data/redist/xmlscan/doc/ja/manual.ja.html +0 -325
- data/redist/xmlscan/doc/ja/manual.ja.rd +0 -370
- data/redist/xmlscan/doc/src/Makefile +0 -41
- data/redist/xmlscan/doc/src/conformance.rd.src +0 -256
- data/redist/xmlscan/doc/src/langsplit.rb +0 -110
- data/redist/xmlscan/doc/src/manual.rd.src +0 -614
- data/redist/xmlscan/install.rb +0 -41
- data/redist/xmlscan/lib/xmlscan/encoding.rb +0 -311
- data/redist/xmlscan/lib/xmlscan/htmlscan.rb +0 -289
- data/redist/xmlscan/lib/xmlscan/namespace.rb +0 -352
- data/redist/xmlscan/lib/xmlscan/parser.rb +0 -299
- data/redist/xmlscan/lib/xmlscan/scanner.rb +0 -1109
- data/redist/xmlscan/lib/xmlscan/version.rb +0 -22
- data/redist/xmlscan/lib/xmlscan/visitor.rb +0 -158
- data/redist/xmlscan/lib/xmlscan/xmlchar.rb +0 -441
- data/redist/xmlscan/memo/CONFORMANCE +0 -1249
- data/redist/xmlscan/memo/PRODUCTIONS +0 -195
- data/redist/xmlscan/memo/contentspec.ry +0 -335
- data/redist/xmlscan/samples/chibixml.rb +0 -105
- data/redist/xmlscan/samples/getxmlchar.rb +0 -122
- data/redist/xmlscan/samples/rexml.rb +0 -159
- data/redist/xmlscan/samples/xmlbench.rb +0 -88
- data/redist/xmlscan/samples/xmlbench/parser/chibixml.rb +0 -22
- data/redist/xmlscan/samples/xmlbench/parser/nqxml.rb +0 -29
- data/redist/xmlscan/samples/xmlbench/parser/rexml.rb +0 -62
- data/redist/xmlscan/samples/xmlbench/parser/xmlparser.rb +0 -22
- data/redist/xmlscan/samples/xmlbench/parser/xmlscan-0.0.10.rb +0 -62
- data/redist/xmlscan/samples/xmlbench/parser/xmlscan-chibixml.rb +0 -22
- data/redist/xmlscan/samples/xmlbench/parser/xmlscan-rexml.rb +0 -22
- data/redist/xmlscan/samples/xmlbench/parser/xmlscan.rb +0 -99
- data/redist/xmlscan/samples/xmlbench/xmlbench-lib.rb +0 -116
- data/redist/xmlscan/samples/xmlconftest.rb +0 -200
- data/redist/xmlscan/test.rb +0 -7
- data/redist/xmlscan/tests/deftestcase.rb +0 -73
- data/redist/xmlscan/tests/runtest.rb +0 -47
- data/redist/xmlscan/tests/testall.rb +0 -14
- data/redist/xmlscan/tests/testencoding.rb +0 -438
- data/redist/xmlscan/tests/testhtmlscan.rb +0 -752
- data/redist/xmlscan/tests/testnamespace.rb +0 -457
- data/redist/xmlscan/tests/testparser.rb +0 -591
- data/redist/xmlscan/tests/testscanner.rb +0 -1749
- data/redist/xmlscan/tests/testxmlchar.rb +0 -143
- data/redist/xmlscan/tests/visitor.rb +0 -34
@@ -1,22 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# samples/xmlbench/parser/chibixml.rb
|
3
|
-
#
|
4
|
-
# Copyright (C) UENO Katsuhiro 2002
|
5
|
-
#
|
6
|
-
# $Id: chibixml.rb,v 1.1 2002/12/26 17:32:46 katsu Exp $
|
7
|
-
#
|
8
|
-
|
9
|
-
require 'chibiparse'
|
10
|
-
|
11
|
-
|
12
|
-
class BenchChibiXML < XMLBench
|
13
|
-
|
14
|
-
def name
|
15
|
-
'chibixml-20010306'
|
16
|
-
end
|
17
|
-
|
18
|
-
def parse(src)
|
19
|
-
ChibiXML.parse src
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# samples/xmlbench/parser/nqxml.rb
|
3
|
-
#
|
4
|
-
# Copyright (C) UENO Katsuhiro 2002
|
5
|
-
#
|
6
|
-
# $Id: nqxml.rb,v 1.1 2002/12/26 17:32:46 katsu Exp $
|
7
|
-
#
|
8
|
-
|
9
|
-
require 'nqxml/streamingparser'
|
10
|
-
require 'nqxml/treeparser'
|
11
|
-
|
12
|
-
|
13
|
-
class BenchNQXMLStream < XMLBench
|
14
|
-
|
15
|
-
def name
|
16
|
-
'NQXML::StreamingParser'
|
17
|
-
end
|
18
|
-
|
19
|
-
def parse(src)
|
20
|
-
parser = NQXML::StreamingParser.new(src)
|
21
|
-
parser.instance_eval {
|
22
|
-
@tokenizer.instance_eval {
|
23
|
-
@internalEntities.default = ''
|
24
|
-
}
|
25
|
-
}
|
26
|
-
parser.each { }
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|
@@ -1,62 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# samples/xmlbench/parser/rexml.rb
|
3
|
-
#
|
4
|
-
# Copyright (C) UENO Katsuhiro 2002
|
5
|
-
#
|
6
|
-
# $Id: rexml.rb,v 1.2 2003/03/16 02:38:02 katsu Exp $
|
7
|
-
#
|
8
|
-
|
9
|
-
require 'rexml/document'
|
10
|
-
require 'rexml/streamlistener'
|
11
|
-
require 'rexml/pullparser'
|
12
|
-
|
13
|
-
|
14
|
-
class BenchREXMLStream < XMLBench
|
15
|
-
|
16
|
-
class REXMLListener
|
17
|
-
include REXML::StreamListener
|
18
|
-
end
|
19
|
-
|
20
|
-
def name
|
21
|
-
'REXML::Document.parse_stream'
|
22
|
-
end
|
23
|
-
|
24
|
-
def parse(src)
|
25
|
-
s = REXML::SourceFactory.create_from(src)
|
26
|
-
REXML::Document.parse_stream s, REXMLListener.new
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|
30
|
-
|
31
|
-
|
32
|
-
class BenchREXMLTree < XMLBench
|
33
|
-
|
34
|
-
class REXMLListener
|
35
|
-
include REXML::StreamListener
|
36
|
-
end
|
37
|
-
|
38
|
-
def name
|
39
|
-
'REXML::Document.new'
|
40
|
-
end
|
41
|
-
|
42
|
-
def parse(src)
|
43
|
-
REXML::Document.new src
|
44
|
-
end
|
45
|
-
|
46
|
-
end
|
47
|
-
|
48
|
-
|
49
|
-
class BenchREXMLPull < XMLBench
|
50
|
-
|
51
|
-
def name
|
52
|
-
'REXML::PullParser'
|
53
|
-
end
|
54
|
-
|
55
|
-
def parse(src)
|
56
|
-
parser = REXML::PullParser.new(src)
|
57
|
-
until parser.empty?
|
58
|
-
parser.next
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# samples/xmlbench/parser/xmlparser.rb
|
3
|
-
#
|
4
|
-
# Copyright (C) UENO Katsuhiro 2002
|
5
|
-
#
|
6
|
-
# $Id: xmlparser.rb,v 1.1 2002/12/26 17:32:46 katsu Exp $
|
7
|
-
#
|
8
|
-
|
9
|
-
require 'xmlparser'
|
10
|
-
|
11
|
-
|
12
|
-
class BenchXMLParser < XMLBench
|
13
|
-
|
14
|
-
def name
|
15
|
-
'XMLParser'
|
16
|
-
end
|
17
|
-
|
18
|
-
def parse(src)
|
19
|
-
XMLParser.new.parse src
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
@@ -1,62 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# samples/xmlbench/parser/xmlscan-0.0.10.rb
|
3
|
-
#
|
4
|
-
# Copyright (C) UENO Katsuhiro 2002
|
5
|
-
#
|
6
|
-
# $Id: xmlscan-0.0.10.rb,v 1.1 2002/12/26 17:32:46 katsu Exp $
|
7
|
-
#
|
8
|
-
|
9
|
-
require 'xmlscan'
|
10
|
-
|
11
|
-
|
12
|
-
class BenchXMLScan0010 < XMLBench
|
13
|
-
|
14
|
-
class Scanner < XMLScanner
|
15
|
-
def entityref_literal(ref) '' end
|
16
|
-
end
|
17
|
-
|
18
|
-
def name
|
19
|
-
'xmlscan-0.0.10 XMLScanner'
|
20
|
-
end
|
21
|
-
|
22
|
-
def parse(src)
|
23
|
-
Scanner.new.parse src
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
class BenchXMLScan0010Parser < XMLBench
|
31
|
-
|
32
|
-
class Scanner < WellFormedXMLScanner
|
33
|
-
def entityref_literal(ref) '' end
|
34
|
-
end
|
35
|
-
|
36
|
-
def name
|
37
|
-
'xmlscan-0.0.10 WellFormed'
|
38
|
-
end
|
39
|
-
|
40
|
-
def parse(src)
|
41
|
-
Scanner.new.parse src
|
42
|
-
end
|
43
|
-
|
44
|
-
end
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
class BenchXMLScan0010ParserNamespace < XMLBench
|
49
|
-
|
50
|
-
class Scanner < XMLScannerWithNamespace
|
51
|
-
def entityref_literal(ref) '' end
|
52
|
-
end
|
53
|
-
|
54
|
-
def name
|
55
|
-
'xmlscan-0.0.10 Namespace'
|
56
|
-
end
|
57
|
-
|
58
|
-
def parse(src)
|
59
|
-
Scanner.new.parse src
|
60
|
-
end
|
61
|
-
|
62
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# samples/xmlbench/parser/xmlscan-chibixml.rb
|
3
|
-
#
|
4
|
-
# Copyright (C) UENO Katsuhiro 2002
|
5
|
-
#
|
6
|
-
# $Id: xmlscan-chibixml.rb,v 1.1 2002/12/26 17:32:46 katsu Exp $
|
7
|
-
#
|
8
|
-
|
9
|
-
require 'samples/chibixml'
|
10
|
-
|
11
|
-
|
12
|
-
class BenchXMLScanChibiXML < XMLBench
|
13
|
-
|
14
|
-
def name
|
15
|
-
'XMLScan::ChibiXML'
|
16
|
-
end
|
17
|
-
|
18
|
-
def parse(src)
|
19
|
-
XMLScan::ChibiXML.parse src
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# samples/xmlbench/parser/xmlscan-rexml.rb
|
3
|
-
#
|
4
|
-
# Copyright (C) UENO Katsuhiro 2002
|
5
|
-
#
|
6
|
-
# $Id: xmlscan-rexml.rb,v 1.1 2002/12/26 17:32:46 katsu Exp $
|
7
|
-
#
|
8
|
-
|
9
|
-
require 'samples/rexml'
|
10
|
-
|
11
|
-
|
12
|
-
class BenchXMLScanREXML < XMLBench
|
13
|
-
|
14
|
-
def name
|
15
|
-
'XMLScan::REXML'
|
16
|
-
end
|
17
|
-
|
18
|
-
def parse(src)
|
19
|
-
XMLScan::REXML.parse src
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
@@ -1,99 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# samples/xmlbench/parser/xmlscan.rb
|
3
|
-
#
|
4
|
-
# Copyright (C) UENO Katsuhiro 2002
|
5
|
-
#
|
6
|
-
# $Id: xmlscan.rb,v 1.2 2003/01/18 07:05:19 katsu Exp $
|
7
|
-
#
|
8
|
-
|
9
|
-
require 'xmlscan/scanner'
|
10
|
-
require 'xmlscan/parser'
|
11
|
-
require 'xmlscan/namespace'
|
12
|
-
require 'xmlscan/xmlchar'
|
13
|
-
|
14
|
-
|
15
|
-
class BenchXMLScan < XMLBench
|
16
|
-
|
17
|
-
class Visitor
|
18
|
-
include XMLScan::Visitor
|
19
|
-
end
|
20
|
-
|
21
|
-
def name
|
22
|
-
'XMLScan::XMLScanner'
|
23
|
-
end
|
24
|
-
|
25
|
-
def parse(src)
|
26
|
-
XMLScan::XMLScanner.new(Visitor.new).parse src
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
class BenchXMLScanParser < XMLBench
|
34
|
-
|
35
|
-
class Visitor
|
36
|
-
include XMLScan::Visitor
|
37
|
-
def on_stag(*) @attrs = {} end
|
38
|
-
def on_attribute(name) @attrs[name] = @attr = '' end
|
39
|
-
def on_attr_value(str) @attr << str end
|
40
|
-
def on_attr_charref(str) @attr << [str].pack('U') end
|
41
|
-
end
|
42
|
-
|
43
|
-
def name
|
44
|
-
'XMLScan::XMLParser'
|
45
|
-
end
|
46
|
-
|
47
|
-
def parse(src)
|
48
|
-
XMLScan::XMLParser.new(Visitor.new).parse src
|
49
|
-
end
|
50
|
-
|
51
|
-
end
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
class BenchXMLScanParserNamespace < XMLBench
|
56
|
-
|
57
|
-
class Visitor
|
58
|
-
include XMLScan::NSVisitor
|
59
|
-
def on_stag_ns(*) @attrs = {} end
|
60
|
-
def on_attribute_ns(name,p,l) @attrs[name] = @attr = '' end
|
61
|
-
def on_attr_value(str) @attr << str end
|
62
|
-
def on_attr_charref(str) @attr << [str].pack('U') end
|
63
|
-
end
|
64
|
-
|
65
|
-
def name
|
66
|
-
'XMLScan::XMLNamespace'
|
67
|
-
end
|
68
|
-
|
69
|
-
def parse(src)
|
70
|
-
XMLScan::XMLParserNS.new(Visitor.new).parse src
|
71
|
-
end
|
72
|
-
|
73
|
-
end
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
class BenchXMLScanParserStrict < XMLBench
|
78
|
-
|
79
|
-
class Visitor
|
80
|
-
include XMLScan::Visitor
|
81
|
-
def on_stag(*) @attrs = {} end
|
82
|
-
def on_attribute(name) @attrs[name] = @attr = '' end
|
83
|
-
def on_attr_value(str) @attr << str end
|
84
|
-
def on_attr_charref(str) @attr << [str].pack('U') end
|
85
|
-
end
|
86
|
-
|
87
|
-
def name
|
88
|
-
'XMLScan::XMLParser (strict)'
|
89
|
-
end
|
90
|
-
|
91
|
-
def weight
|
92
|
-
10
|
93
|
-
end
|
94
|
-
|
95
|
-
def parse(src)
|
96
|
-
XMLScan::XMLParser.new(Visitor.new, :strict_char).parse src
|
97
|
-
end
|
98
|
-
|
99
|
-
end
|
@@ -1,116 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# samples/xmlbench/xmlbench-lib.rb
|
3
|
-
#
|
4
|
-
# Copyright (C) UENO Katsuhiro 2002
|
5
|
-
#
|
6
|
-
# $Id: xmlbench-lib.rb,v 1.3 2002/12/29 17:18:57 katsu Exp $
|
7
|
-
#
|
8
|
-
|
9
|
-
class XMLBench
|
10
|
-
|
11
|
-
def name
|
12
|
-
self.class.name
|
13
|
-
end
|
14
|
-
|
15
|
-
def weight
|
16
|
-
0
|
17
|
-
end
|
18
|
-
|
19
|
-
def parse(src)
|
20
|
-
raise NotImplementedError, "abstract method"
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
class XMLBench
|
28
|
-
|
29
|
-
ParserDir = File.expand_path(File.dirname(__FILE__)) + '/parser'
|
30
|
-
@@parsers = []
|
31
|
-
@@parser_classes = []
|
32
|
-
@@weight_limit = 0
|
33
|
-
|
34
|
-
class << self
|
35
|
-
|
36
|
-
def weight_limit=(n)
|
37
|
-
@@weight_limit = n
|
38
|
-
end
|
39
|
-
|
40
|
-
private
|
41
|
-
|
42
|
-
def load(name)
|
43
|
-
@@parsers.push name
|
44
|
-
filename = "#{XMLBench::ParserDir}/#{name}.rb"
|
45
|
-
ret = nil
|
46
|
-
if File.file? filename then
|
47
|
-
loaded = true
|
48
|
-
begin
|
49
|
-
Kernel.load "#{XMLBench::ParserDir}/#{name}.rb"
|
50
|
-
rescue Exception
|
51
|
-
loaded = false
|
52
|
-
end
|
53
|
-
if loaded then
|
54
|
-
klasses = []
|
55
|
-
ObjectSpace.each_object(Class) { |klass|
|
56
|
-
if not equal? klass and klass.ancestors.include? self then
|
57
|
-
klasses.push klass
|
58
|
-
end
|
59
|
-
}
|
60
|
-
ret = klasses - @@parser_classes
|
61
|
-
@@parser_classes = klasses
|
62
|
-
ret.sort! { |a,b| a.name <=> b.name }
|
63
|
-
end
|
64
|
-
end
|
65
|
-
ret
|
66
|
-
end
|
67
|
-
|
68
|
-
public
|
69
|
-
|
70
|
-
def setup(*args)
|
71
|
-
ret = []
|
72
|
-
args.each { |name|
|
73
|
-
next if @@parsers.include? name
|
74
|
-
STDERR.print "checking for #{name} ..." if $VERBOSE
|
75
|
-
klasses = load(name)
|
76
|
-
unless klasses then
|
77
|
-
STDERR.print " no" if $VERBOSE
|
78
|
-
else
|
79
|
-
parsers = []
|
80
|
-
klasses.each { |klass|
|
81
|
-
begin
|
82
|
-
obj = klass.new
|
83
|
-
rescue Exception
|
84
|
-
obj = nil
|
85
|
-
end
|
86
|
-
parsers.push obj if obj
|
87
|
-
}
|
88
|
-
if $VERBOSE then
|
89
|
-
if parsers.size < klasses.size then
|
90
|
-
STDERR.print " ok (#{klasses.size - parsers.size} failed)"
|
91
|
-
else
|
92
|
-
STDERR.print " ok"
|
93
|
-
end
|
94
|
-
end
|
95
|
-
parsers.reject! { |i| i.weight > @@weight_limit }
|
96
|
-
ret.concat parsers
|
97
|
-
end
|
98
|
-
STDERR.print "\n" if $VERBOSE
|
99
|
-
}
|
100
|
-
ret
|
101
|
-
end
|
102
|
-
|
103
|
-
def setup_all
|
104
|
-
files = Dir.entries(XMLBench::ParserDir)
|
105
|
-
files.reject! { |i| /\.rb\z/ !~ i }
|
106
|
-
files.collect! { |i| i[0..-4] }
|
107
|
-
xmlscan = files.select { |i| /\Axmlscan/ =~ i }
|
108
|
-
files = files.reject { |i| /\Axmlscan/ =~ i }
|
109
|
-
xmlscan.sort!
|
110
|
-
files.sort!
|
111
|
-
setup(*xmlscan.concat(files))
|
112
|
-
end
|
113
|
-
|
114
|
-
end
|
115
|
-
|
116
|
-
end
|