rgen 0.5.4 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. data/CHANGELOG +28 -0
  2. data/Rakefile +3 -4
  3. data/lib/ea_support/uml13_ea_metamodel.rb +3 -3
  4. data/lib/ea_support/uml13_ea_to_uml13.rb +33 -2
  5. data/lib/ea_support/uml13_to_uml13_ea.rb +7 -0
  6. data/lib/mmgen/mm_ext/ecore_mmgen_ext.rb +4 -4
  7. data/lib/mmgen/templates/metamodel_generator.tpl +143 -143
  8. data/lib/rgen/ecore/ecore.rb +11 -1
  9. data/lib/rgen/ecore/ecore_interface.rb +47 -0
  10. data/lib/rgen/ecore/ecore_to_ruby.rb +166 -0
  11. data/lib/rgen/ecore/{ecore_transformer.rb → ruby_to_ecore.rb} +11 -11
  12. data/lib/rgen/environment.rb +15 -2
  13. data/lib/rgen/fragment/dump_file_cache.rb +63 -0
  14. data/lib/rgen/fragment/fragmented_model.rb +139 -0
  15. data/lib/rgen/fragment/model_fragment.rb +268 -0
  16. data/lib/rgen/instantiator/abstract_xml_instantiator.rb +44 -72
  17. data/lib/rgen/instantiator/default_xml_instantiator.rb +2 -2
  18. data/lib/rgen/instantiator/ecore_xml_instantiator.rb +16 -1
  19. data/lib/rgen/instantiator/json_instantiator.rb +16 -2
  20. data/lib/rgen/instantiator/nodebased_xml_instantiator.rb +118 -138
  21. data/lib/rgen/instantiator/qualified_name_resolver.rb +5 -1
  22. data/lib/rgen/instantiator/reference_resolver.rb +126 -24
  23. data/lib/rgen/instantiator/xmi11_instantiator.rb +6 -2
  24. data/lib/rgen/metamodel_builder.rb +18 -6
  25. data/lib/rgen/metamodel_builder/builder_extensions.rb +431 -407
  26. data/lib/rgen/metamodel_builder/builder_runtime.rb +8 -8
  27. data/lib/rgen/metamodel_builder/constant_order_helper.rb +4 -4
  28. data/lib/rgen/metamodel_builder/data_types.rb +5 -1
  29. data/lib/rgen/metamodel_builder/intermediate/feature.rb +167 -0
  30. data/lib/rgen/metamodel_builder/module_extension.rb +2 -2
  31. data/lib/rgen/model_builder.rb +10 -5
  32. data/lib/rgen/model_builder/builder_context.rb +17 -1
  33. data/lib/rgen/serializer/opposite_reference_filter.rb +18 -0
  34. data/lib/rgen/serializer/qualified_name_provider.rb +45 -0
  35. data/lib/rgen/template_language/template_container.rb +3 -1
  36. data/lib/rgen/{auto_class_creator.rb → util/auto_class_creator.rb} +6 -1
  37. data/lib/rgen/util/cached_glob.rb +67 -0
  38. data/lib/rgen/util/file_cache_map.rb +104 -0
  39. data/lib/rgen/util/file_change_detector.rb +78 -0
  40. data/lib/rgen/{method_delegation.rb → util/method_delegation.rb} +18 -3
  41. data/lib/rgen/{model_comparator.rb → util/model_comparator.rb} +17 -5
  42. data/lib/rgen/{model_comparator_base.rb → util/model_comparator_base.rb} +6 -1
  43. data/lib/rgen/{model_dumper.rb → util/model_dumper.rb} +6 -1
  44. data/lib/rgen/{name_helper.rb → util/name_helper.rb} +6 -1
  45. data/lib/rgen/util/pattern_matcher.rb +329 -0
  46. data/lib/transformers/uml13_to_ecore.rb +103 -60
  47. data/test/ecore_self_test.rb +43 -42
  48. data/test/json_test.rb +15 -0
  49. data/test/metamodel_builder_test.rb +361 -206
  50. data/test/metamodel_from_ecore_test.rb +45 -0
  51. data/test/metamodel_order_test.rb +10 -4
  52. data/test/metamodel_roundtrip_test.rb +2 -2
  53. data/test/metamodel_roundtrip_test/TestModel_Regenerated.rb +1 -1
  54. data/test/metamodel_roundtrip_test/houseMetamodel_Regenerated.ecore +50 -50
  55. data/test/method_delegation_test.rb +9 -9
  56. data/test/model_builder/ecore_internal.rb +19 -9
  57. data/test/model_builder/serializer_test.rb +1 -1
  58. data/test/reference_resolver_test.rb +79 -12
  59. data/test/rgen_test.rb +2 -0
  60. data/test/template_language_test.rb +7 -0
  61. data/test/template_language_test/templates/callback_indent_test/a.tpl +12 -0
  62. data/test/template_language_test/templates/callback_indent_test/b.tpl +5 -0
  63. data/test/testmodel/ea_testmodel_regenerated.xml +588 -583
  64. data/test/transformer_test.rb +3 -3
  65. data/test/util/file_cache_map_test.rb +91 -0
  66. data/test/util/file_cache_map_test/testdir/fileA +1 -0
  67. data/test/util_test.rb +4 -0
  68. data/test/xml_instantiator_test.rb +139 -135
  69. metadata +49 -104
  70. data/lib/rgen/ecore/ecore_instantiator.rb +0 -31
  71. data/lib/rgen/metamodel_builder/metamodel_description.rb +0 -232
  72. data/redist/xmlscan/ChangeLog +0 -1301
  73. data/redist/xmlscan/README +0 -34
  74. data/redist/xmlscan/THANKS +0 -11
  75. data/redist/xmlscan/doc/changes.html +0 -74
  76. data/redist/xmlscan/doc/changes.rd +0 -80
  77. data/redist/xmlscan/doc/en/conformance.html +0 -136
  78. data/redist/xmlscan/doc/en/conformance.rd +0 -152
  79. data/redist/xmlscan/doc/en/manual.html +0 -356
  80. data/redist/xmlscan/doc/en/manual.rd +0 -402
  81. data/redist/xmlscan/doc/ja/conformance.ja.html +0 -118
  82. data/redist/xmlscan/doc/ja/conformance.ja.rd +0 -134
  83. data/redist/xmlscan/doc/ja/manual.ja.html +0 -325
  84. data/redist/xmlscan/doc/ja/manual.ja.rd +0 -370
  85. data/redist/xmlscan/doc/src/Makefile +0 -41
  86. data/redist/xmlscan/doc/src/conformance.rd.src +0 -256
  87. data/redist/xmlscan/doc/src/langsplit.rb +0 -110
  88. data/redist/xmlscan/doc/src/manual.rd.src +0 -614
  89. data/redist/xmlscan/install.rb +0 -41
  90. data/redist/xmlscan/lib/xmlscan/encoding.rb +0 -311
  91. data/redist/xmlscan/lib/xmlscan/htmlscan.rb +0 -289
  92. data/redist/xmlscan/lib/xmlscan/namespace.rb +0 -352
  93. data/redist/xmlscan/lib/xmlscan/parser.rb +0 -299
  94. data/redist/xmlscan/lib/xmlscan/scanner.rb +0 -1109
  95. data/redist/xmlscan/lib/xmlscan/version.rb +0 -22
  96. data/redist/xmlscan/lib/xmlscan/visitor.rb +0 -158
  97. data/redist/xmlscan/lib/xmlscan/xmlchar.rb +0 -441
  98. data/redist/xmlscan/memo/CONFORMANCE +0 -1249
  99. data/redist/xmlscan/memo/PRODUCTIONS +0 -195
  100. data/redist/xmlscan/memo/contentspec.ry +0 -335
  101. data/redist/xmlscan/samples/chibixml.rb +0 -105
  102. data/redist/xmlscan/samples/getxmlchar.rb +0 -122
  103. data/redist/xmlscan/samples/rexml.rb +0 -159
  104. data/redist/xmlscan/samples/xmlbench.rb +0 -88
  105. data/redist/xmlscan/samples/xmlbench/parser/chibixml.rb +0 -22
  106. data/redist/xmlscan/samples/xmlbench/parser/nqxml.rb +0 -29
  107. data/redist/xmlscan/samples/xmlbench/parser/rexml.rb +0 -62
  108. data/redist/xmlscan/samples/xmlbench/parser/xmlparser.rb +0 -22
  109. data/redist/xmlscan/samples/xmlbench/parser/xmlscan-0.0.10.rb +0 -62
  110. data/redist/xmlscan/samples/xmlbench/parser/xmlscan-chibixml.rb +0 -22
  111. data/redist/xmlscan/samples/xmlbench/parser/xmlscan-rexml.rb +0 -22
  112. data/redist/xmlscan/samples/xmlbench/parser/xmlscan.rb +0 -99
  113. data/redist/xmlscan/samples/xmlbench/xmlbench-lib.rb +0 -116
  114. data/redist/xmlscan/samples/xmlconftest.rb +0 -200
  115. data/redist/xmlscan/test.rb +0 -7
  116. data/redist/xmlscan/tests/deftestcase.rb +0 -73
  117. data/redist/xmlscan/tests/runtest.rb +0 -47
  118. data/redist/xmlscan/tests/testall.rb +0 -14
  119. data/redist/xmlscan/tests/testencoding.rb +0 -438
  120. data/redist/xmlscan/tests/testhtmlscan.rb +0 -752
  121. data/redist/xmlscan/tests/testnamespace.rb +0 -457
  122. data/redist/xmlscan/tests/testparser.rb +0 -591
  123. data/redist/xmlscan/tests/testscanner.rb +0 -1749
  124. data/redist/xmlscan/tests/testxmlchar.rb +0 -143
  125. data/redist/xmlscan/tests/visitor.rb +0 -34
@@ -1,143 +0,0 @@
1
- #
2
- # tests/xmlchar.rb
3
- #
4
- # Copyright (C) Ueno Katsuhiro 2002
5
- #
6
- # $Id: testxmlchar.rb,v 1.4 2005/05/22 07:07:12 nahi Exp $
7
- #
8
-
9
- require 'test/unit'
10
- require 'deftestcase'
11
- require 'xmlscan/xmlchar'
12
- require 'visitor'
13
-
14
-
15
- class TestXMLChar < Test::Unit::TestCase
16
-
17
- include XMLScan::XMLChar
18
-
19
- def test_valid_char_p
20
- assert_equal true, valid_char?(9)
21
- assert_equal true, valid_char?(10)
22
- assert_equal true, valid_char?(13)
23
- assert_equal true, valid_char?(32)
24
- assert_equal false, valid_char?(8)
25
- assert_equal true, valid_char?(0xfffd)
26
- assert_equal false, valid_char?(0xfffe)
27
- assert_equal false, valid_char?(0xffff)
28
- assert_equal false, valid_char?(0x200000)
29
- end
30
-
31
-
32
- # \xE3\x81\xBB = ho
33
- # \xE3\x81\x92 = ge
34
- # \xE3\x81\xB5 = fu
35
- # \xE3\x81\x8C = ga
36
-
37
- Hoge = "\xE3\x81\xBB\xE3\x81\x92"
38
- Fuga = "\xE3\x81\xB5\xE3\x81\x8C"
39
-
40
- Testcases = [
41
- # chardata? nmtoken? name?
42
- [ 'hogefuga', true, true, true ],
43
- [ Hoge+Fuga, true, true, true ],
44
- [ Hoge+' '+Fuga, true, false, false ],
45
- [ Hoge+"\n"+Fuga, true, false, false ],
46
- [ Hoge+"\r"+Fuga, true, false, false ],
47
- [ Hoge+"\t"+Fuga, true, false, false ],
48
- [ Hoge+"\f"+Fuga, false, false, false ],
49
- [ Hoge+'.'+Fuga, true, true, true ],
50
- [ Hoge+'-'+Fuga, true, true, true ],
51
- [ Hoge+'_'+Fuga, true, true, true ],
52
- [ Hoge+':'+Fuga, true, true, true ],
53
- [ Hoge+'%'+Fuga, true, false, false ],
54
- [ '.'+Hoge+Fuga, true, true, false ],
55
- [ '-'+Hoge+Fuga, true, true, false ],
56
- [ '_'+Hoge+Fuga, true, true, true ],
57
- [ ':'+Hoge+Fuga, true, true, true ],
58
- [ '%'+Hoge+Fuga, true, false, false ],
59
- [ Hoge+"\xfe"+Fuga, false, false, false ],
60
- [ Hoge+"\xff"+Fuga, false, false, false ],
61
- [ [0xffff].pack('U'), false, false, false ],
62
- ]
63
-
64
-
65
- def test_valid_chardata_p
66
- Testcases.each { |str,expect,|
67
- assert_equal expect, valid_chardata?(str), str.inspect
68
- }
69
- end
70
-
71
- def test_valid_nmtoken_p
72
- Testcases.each { |str,dummy,expect,|
73
- assert_equal expect, valid_nmtoken?(str), str.inspect
74
- }
75
- end
76
-
77
- def test_valid_name_p
78
- Testcases.each { |str,dummy,dummy,expect,|
79
- assert_equal expect, valid_name?(str), str.inspect
80
- }
81
- end
82
-
83
- end
84
-
85
-
86
-
87
- class TestXMLScannerStrict < Test::Unit::TestCase
88
-
89
- include DefTestCase
90
-
91
- Visitor = RecordingVisitor.new_class(XMLScan::Visitor)
92
-
93
-
94
- private
95
-
96
- def setup
97
- @origkcode = $KCODE
98
- $KCODE = 'U'
99
- @v = Visitor.new
100
- @s = XMLScan::XMLScanner.new(@v, :strict_char)
101
- end
102
-
103
- def teardown
104
- $KCODE = @origkcode
105
- end
106
-
107
- def parse(src)
108
- @s.parse src
109
- @v.result
110
- end
111
-
112
-
113
- public
114
-
115
- Hoge = TestXMLChar::Hoge
116
- Fuga = TestXMLChar::Fuga
117
-
118
-
119
- deftestcase 'document', <<-'TESTCASEEND'
120
-
121
- "<:.#{Hoge}>hoge</:.#{Hoge}>"
122
- [ :on_stag, ":.#{Hoge}" ]
123
- [ :on_stag_end, ":.#{Hoge}" ]
124
- [ :on_chardata, "hoge" ]
125
- [ :on_etag, ":.#{Hoge}" ]
126
-
127
- "<.:#{Hoge}>hoge</.:#{Hoge}>"
128
- [ :parse_error, "`.:#{Hoge}' is not valid for XML name"]
129
- [ :on_stag, ".:#{Hoge}" ]
130
- [ :on_stag_end, ".:#{Hoge}" ]
131
- [ :on_chardata, "hoge" ]
132
- [ :parse_error, "`.:#{Hoge}' is not valid for XML name"]
133
- [ :on_etag, ".:#{Hoge}" ]
134
-
135
- TESTCASEEND
136
-
137
- end
138
-
139
-
140
-
141
-
142
-
143
- load "#{File.dirname($0)}/runtest.rb" if __FILE__ == $0
@@ -1,34 +0,0 @@
1
- #
2
- # tests/visitor.rb
3
- #
4
- # Copyright (C) UENO Katsuhiro 2002
5
- #
6
- # $Id: visitor.rb,v 1.3 2002/09/24 21:39:30 katsu Exp $
7
- #
8
-
9
- module RecordingVisitor
10
-
11
- def initialize
12
- @result = []
13
- end
14
-
15
- attr_reader :result
16
-
17
- def self.new_class(visitor)
18
- klass = Class.new
19
- mod = self
20
- klass.module_eval { include mod, visitor }
21
- methods = visitor.instance_methods
22
- visitor.included_modules.each { |i| methods.concat i.instance_methods }
23
- methods.sort.uniq.each { |i|
24
- klass.module_eval <<-END, __FILE__, __LINE__ + 1
25
- def #{i}(*args)
26
- @result.push [ :#{i} ].concat(args)
27
- end
28
- END
29
- }
30
- klass
31
- end
32
-
33
-
34
- end