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,110 +0,0 @@
1
- #!/usr/bin/ruby
2
- #
3
- # langsplit.rb
4
- #
5
- # $Id: langsplit.rb,v 1.1 2003/01/22 16:41:45 katsu Exp $
6
- #
7
-
8
-
9
- class TextBlockReader
10
-
11
- def initialize(file)
12
- @file = file
13
- @last = nil
14
- end
15
-
16
- public
17
-
18
- def gets
19
- lang = nil
20
- @last = @last || @file.gets
21
- lang = $1 if /\A\s+([a-z][a-z])\| / =~ @last
22
- dst = []
23
- while @last
24
- if /\A\s*\z/ =~ @last then
25
- dst.push @last
26
- dst.push @last while /\A\s*\z/ =~ (@last = @file.gets)
27
- break
28
- elsif /\A\s+([a-z][a-z])\|(?: | *$)/ =~ @last then
29
- break unless $1 == lang
30
- dst.push $'
31
- else
32
- break if lang
33
- dst.push @last
34
- end
35
- @last = @file.gets
36
- end
37
- (@last or not dst.empty?) and [ lang, dst ]
38
- end
39
-
40
- end
41
-
42
-
43
- class LangSplit
44
-
45
- DefaultLanguage = 'ja'
46
-
47
- def initialize(filename, lang)
48
- lang = nil if lang == DefaultLanguage
49
- @lang = lang
50
- @file = File.open(filename)
51
- @reader = TextBlockReader.new(@file)
52
- @last = nil
53
- end
54
-
55
- def close
56
- @file.close
57
- end
58
-
59
- def self.open(*args)
60
- f = new(*args)
61
- begin
62
- yield f
63
- ensure
64
- f.close
65
- end
66
- end
67
-
68
- def gets
69
- lang, text = @last = @last || @reader.gets
70
- return nil unless @last
71
- raise "syntax error" if lang
72
- indent = text.reject { |i| i.strip.empty? }.
73
- collect { |i| /\A\s*/.match(i)[0] }.
74
- min { |a,b| a.size <=> b.size }
75
- lastspace = []
76
- texts = {}
77
- while true
78
- lastspace.clear
79
- lastspace.push text.pop while /\A\s*\z/ =~ text.last
80
- (texts[lang] || texts[lang] = []).concat(text)
81
- @last = @reader.gets
82
- lang, text = @last
83
- break unless @last and lang
84
- text.each { |i| i[0,0] = indent unless i.strip.empty? }
85
- end
86
- (texts[@lang] || texts[nil]).concat(lastspace).join
87
- end
88
-
89
- def each
90
- while s = gets
91
- yield s
92
- end
93
- end
94
-
95
- end
96
-
97
-
98
-
99
-
100
- lang = nil
101
-
102
- ARGV.each { |arg|
103
- if /\A-([a-z][a-z])\z/ =~ arg then
104
- lang = $1
105
- else
106
- LangSplit.open(arg, lang) { |f|
107
- f.each { |i| print i }
108
- }
109
- end
110
- }
@@ -1,614 +0,0 @@
1
- =begin
2
- # $Id: manual.rd.src,v 1.1 2003/01/22 16:41:45 katsu Exp $
3
-
4
- = xmlscan version 0.2 ��ե���󥹥ޥ˥奢��
5
-
6
- en| = xmlscan version 0.2 Reference Manual
7
- en|
8
- en| This is a broken English version. If you find lexical or
9
- en| grammatical mistakes, or strange expressions (including kidding,
10
- en| unnatural or unclear ones) in this document, please
11
- en| ((<let me know|URL:mailto:katsu@blue.sky.or.jp>)).
12
-
13
- == ����
14
-
15
- en| == Abstract
16
-
17
- xmlscan �� Ruby �����ǽ񤫤줿 non-validating XML parser �Ǥ���
18
-
19
- en| XMLscan is one of non-validating XML parser written in 100%
20
- en| pure Ruby.
21
-
22
- ���Τ褦����Ĺ������ޤ���
23
-
24
- en| XMLscan's features are as follows:
25
-
26
- : 100% pure Ruby
27
- ��ĥ�饤�֥������ɬ�פȤ��ʤ��Τǡ�1.6 �ʾ�� Ruby ���󥿥ץ꥿����
28
- ����д�����ư��ޤ���(ɸ��ź�դγ�ĥ�饤�֥���ɬ�פȤ��ޤ���)
29
-
30
- en| : 100% pure Ruby
31
- en| XMLscan doesn't require any extension libraries, so
32
- en| it completely works only with a Ruby interpreter version
33
- en| 1.6 or above.
34
- en| (It also needs no standard-bundled extension library.)
35
-
36
- : ���ʤؤ�Ŭ����
37
- xmlscan �ϡ�XML 1.0 Specification �ǽҤ٤��Ƥ��롢�������򸡾ڤ��ʤ�
38
- �ץ������˵��������Ƥξ������������Ȥ���ɸ�˳�ȯ���ʤ����
39
- ���ޤ���
40
-
41
- en| : Compliant to the specification
42
- en| XMLscan has been developed to satisfy all conditions,
43
- en| described in XML 1.0 Specification and required to a
44
- en| non-validating XML processor
45
-
46
- : ��®
47
- xmlscan �β��Ϥ�®���ϡ������餯����¸���� Ruby �ǽ񤫤줿
48
- XML/HTML parser ����Ǻ�®�Ǥ���
49
-
50
- en| : High-speed
51
- en| XMLscan is, probably, the fastest parser among all
52
- en| existing XML/HTML parsers written in pure Ruby.
53
-
54
- : �͡���CES���б�
55
- xmlscan �Ͼ��ʤ��Ȥ� iso-8859-*, EUC-*, Shift_JIS, UTF-8 �ǽ񤫤줿
56
- XMLʸ��򤽤Τޤ޲��ϤǤ��ޤ��������� UTF-16 �ϰ����ޤ���
57
-
58
- en| : Support for various CES.
59
- en| XMLscan can parse an XML document encoded in at least
60
- en| iso-8859-*, EUC-*, Shift_JIS, and UTF-8 as it is.
61
- en| UTF-16 is not supported directly, though.
62
-
63
- : ���Ϥ������
64
- xmlscan �����ϡ�����XMLʸ�����Ϥ��뤳�Ȥ����Ǥ���XMLʸ���
65
- ���ؤ˼�갷������ι��٥�ʵ�ǽ���󶡤��ޤ���xmlscan ��
66
- ���Τ褦�ʵ�ǽ���󶡤���饤�֥��Υ�����ʬ�Ȥ��ƻȤ��뤳�Ȥ�
67
- ���ꤷ�Ƥ��ޤ���
68
-
69
- en| : Just parsing
70
- en| The role of xmlscan is just to parse an XML document.
71
- en| XMLscan doesn't provide high-level features to easily
72
- en| handle an XML document. XMLscan is assumed to be used as
73
- en| a core part of a library providing such features.
74
-
75
- : HTML
76
- ���ޥ��� HTML ��ʸ���Ϥ��� htmlscan ���դ��Ƥ��ޤ���
77
-
78
- en| : HTML
79
- en| XMLscan contains htmlscan, an HTML parser.
80
-
81
-
82
- == ʸ�����󥳡��ǥ��󥰤ˤĤ���
83
-
84
- en| == Character encodings
85
-
86
- �ǥե���ȤǤϡ�xmlscan ���ɤ� CES (Character Encoding Scheme) ��
87
- XMLʸ�����Ϥ��뤫�ϥ������Х��ѿ� $KCODE ���ͤˤ�äƷ�ޤ�ޤ���
88
- EUC-*, Shift_JIS, UTF-8 �ǽ񤫤줿XMLʸ�����Ϥ���ˤ� $KCODE ��
89
- ((<XMLScan::XMLScanner#kcode=>)) ��Ŭ�ڤ��ͤ����ꤹ��ɬ�פ�����ޤ���
90
-
91
- en| By default, the value of global variable $KCODE decides
92
- en| which CES (character encoding scheme) is assumed for xmlscan
93
- en| to parse an XML document.
94
- en| You need to set $KCODE or ((<XMLScan::XMLScanner#kcode=>))
95
- en| an appropriate value to parse an XML document encoded in EUC-*,
96
- en| Shift_JIS, or UTF-8.
97
-
98
- UTF-16 ��ľ�ܥ��ݡ��Ȥ��Ƥ��ޤ��󡣲������˰�ö UTF-8 ���Ѵ�����
99
- ɬ�פ�����ޤ���
100
-
101
- en| UTF-16 is not supported directly. You should convert it into
102
- en| UTF-8 before parsing.
103
-
104
-
105
- == XML̾�����֤ˤĤ���
106
-
107
- en| == XML Namespaces
108
-
109
- XML̾�����֤� xmlscan/namespace.rb �Ǽ�������Ƥ��ޤ��������󥿡��ե�������
110
- �礭���ѹ�����ͽ�꤬���뤿�� undocumented �Ȥ��ޤ���
111
-
112
- en| XML Namespaces have been already implemented in
113
- en| xmlscan/namespace.rb. However, since its interface is going
114
- en| to be modified, this feature is undocumented now.
115
-
116
-
117
-
118
- == ���饹��ե����
119
- en| == Class Reference
120
-
121
-
122
- === XMLScan::Error
123
-
124
- xmlscan �˴ؤ������Ƥ��㳰�Υ����ѡ����饹��
125
-
126
- en| The superclass for all exceptions related to xmlscan.
127
-
128
- �������㳰�ϡ�XMLScan::Visitor �Υ��󥹥��󥹤���XMLScan::XMLScanner ��
129
- XMLScan::XMLParser ���饨�顼���������ä��Ȥ��ˡ��ǥե���Ȥ�ȯ��������
130
- ��ΤǤ����ƥѡ�����ľ�ܤ������㳰���ꤲ�뤳�ȤϤ���ޤ���
131
-
132
- en| These exceptions are raised by XMLScan::Visitor
133
- en| by default when it receives an error report from a parser,
134
- en| such as XMLScan::XMLScanner or XMLScan::XMLParser.
135
- en| Each parser never raises these exceptions by itself.
136
-
137
- #�����㳰�� xmlscan/scanner.rb ���������Ƥ��ޤ���
138
- en| #The following exceptions are defined in xmlscan/scanner.rb:
139
-
140
- : XMLScan::ParseError
141
-
142
- ������§�˥ޥå����ʤ����������ȿ�ʳ��Υ��顼��
143
-
144
- en| An error except a constraint violation, for example,
145
- en| an XML document is unmatched with a production.
146
-
147
- : XMLScan::NotWellFormedError
148
-
149
- ����������˰�ȿ���Ƥ��롣
150
-
151
- en| Raised when an XML document violates an well-formedness
152
- en| constraint.
153
-
154
- : XMLScan::NotValidError
155
-
156
- ����������˰�ȿ���Ƥ��롣
157
-
158
- en| Raised when an XML document violates an validity constraint.
159
-
160
-
161
- === XMLScan::Visitor
162
-
163
- XMLʸ��β��Ϸ�̤������뤿��� Mix-in �Ǥ���
164
-
165
- en| Mix-in for receiving the result of parsing an XML document.
166
-
167
- xmlscan �˴ޤޤ��� parser �ϡ�ʸ�����Ƭ���鹽ʸ���Ϥ�Ԥ�����������
168
- ��ʸ���Ǥ򸫤Ĥ��뤿�Ӥˡ��ѡ�����Ϳ����줿 XMLScan::Visitor ��
169
- ���󥹥��󥹤�����Υ᥽�åɤ�ƤӽФ��ޤ������θƤӽФ��ϡ�ɬ��ʸ���
170
- ��Ƭ������֤˹Ԥ��ޤ���
171
-
172
- en| Each parser included in xmlscan parses an XML document from
173
- en| the beginning, and calls each specific method of given instance of
174
- en| XMLScan::Visitor for each syntactic element, such as a tag.
175
- en| It is ensured that these calls is in order of the appearance
176
- en| in the document from the beginning.
177
-
178
- ==== �᥽�å�:
179
- en| ==== Methods:
180
-
181
- �ä˵��Ҥ�̵���¤ꡢ�ƥ᥽�åɤϥǥե���ȤǤϲ��⤷�ޤ���
182
-
183
- en| Without special notice, the following methods do nothing by
184
- en| default.
185
-
186
- --- XMLScan::Visitor#parse_error(msg)
187
-
188
- ������§�˥ޥå����ʤ����������ȿ�ʳ��Υ��顼��ȯ����������
189
- �ƤӽФ���ޤ����ǥե���ȤǤ� ((<XMLScan::ParseError>))�㳰��
190
- ȯ�������ޤ����㳰�����������æ�Ф�Ԥ鷺�����̤������
191
- �ѡ������֤��ȡ��ѡ����ϥ��顼��������Ʋ��Ϥ�³���ޤ���
192
-
193
- en| Called when the parser meets an error except a constraint
194
- en| violation, for example, an XML document is unmatched with
195
- en| a production. By default, this method raises
196
- en| ((<XMLScan::ParseError>)) exception. If no exception is
197
- en| raised and this method returns normally, the parser recovers
198
- en| the error and continues to parse.
199
-
200
- --- XMLScan::Visitor#wellformed_error(msg)
201
-
202
- �����������ȿ��ȯ���������˸ƤӽФ���ޤ����ǥե���ȤǤ�
203
- ((<XMLScan::NotWellFormedError>))�㳰��ȯ�������ޤ����㳰��������
204
- ���æ�Ф�Ԥ鷺�����̤������ѡ������֤��ȡ��ѡ����ϥ��顼��
205
- �������Ʋ��Ϥ�³���ޤ���
206
-
207
- en| Called when the parser meets an well-formedness constraint
208
- en| violation. By default, this method raises
209
- en| ((<XMLScan::NotWellFormedError>)) exception. If no exception
210
- en| is raised and this method returns normally, the parser recovers
211
- en| the error and continues to parse.
212
-
213
- --- XMLScan::Visitor#valid_error(msg)
214
-
215
- �����������ȿ��ȯ���������˸ƤӽФ���ޤ����ǥե���ȤǤ�
216
- ((<XMLScan::NotValidError>))�㳰��ȯ�������ޤ����㳰��������
217
- ���æ�Ф�Ԥ鷺�����̤������ѡ������֤��ȡ��ѡ����ϥ��顼��
218
- �������Ʋ��Ϥ�³���ޤ���
219
-
220
- en| Called when the parser meets validity constraint
221
- en| violation. By default, this method raises
222
- en| ((<XMLScan::NotValidError>)) exception. If no exception
223
- en| is raised and this method returns normally, the parser recovers
224
- en| the error and continues to parse.
225
-
226
- �ʤ������ߤ� xmlscan �ˤ��������򸡾ڤ���XML�ץ�������
227
- �ޤޤ�Ƥ��ޤ��󡣤��Υ᥽�åɤϾ�����ǤΤ����ͽ�󤵤�Ƥ��ޤ���
228
-
229
- en| FYI, current version of xmlscan includes no validating XML
230
- en| processor. This method is reserved for future versions.
231
-
232
- --- XMLScan::Visitor#warning(msg)
233
-
234
- ���顼�ǤϤʤ����侩����ʤ������䡢xmlscan �ǤϽ�ʬ�˲��ϤǤ��ʤ�
235
- ��ʸ��ȯ���������˸ƤӽФ���ޤ���
236
-
237
- en| Called when the parser meets a non-error but unrecommended
238
- en| thing or a syntax which xmlscan is not able to parse.
239
-
240
- --- XMLScan::Visitor#on_start_document
241
-
242
- XMLʸ��β��Ϥ�Ϥ��ľ���˸ƤӽФ���ޤ������Υ᥽�åɤ��ƤӽФ��줿
243
- ��ˤ�ɬ�����б����� ((<XMLScan::Visitor#on_end_document>)) �᥽�åɤ�
244
- �ƤӽФ���ޤ���
245
-
246
- en| Called just before the parser starts parsing an XML document.
247
- en| After this method is called, corresponding
248
- en| ((<XMLScan::Visitor#on_end_document>)) method is always called.
249
-
250
- --- XMLScan::Visitor#on_end_document
251
-
252
- XMLʸ��ν�ü�ޤDz��Ϥ����ä���˸ƤӽФ���ޤ���
253
-
254
- en| Called after the parser reaches the end of an XML document.
255
-
256
- --- XMLScan::Visitor#on_xmldecl
257
- --- XMLScan::Visitor#on_xmldecl_version(str)
258
- --- XMLScan::Visitor#on_xmldecl_encoding(str)
259
- --- XMLScan::Visitor#on_xmldecl_standalone(str)
260
- --- XMLScan::Visitor#on_xmldecl_other(name, value)
261
- --- XMLScan::Visitor#on_xmldecl_end
262
-
263
- XML�����ȯ���������˸ƤӽФ���ޤ���
264
-
265
- en| Called when the parser meets an XML declaration.
266
-
267
- <?xml version="1.0" encoding="euc-jp" standalone="yes" ?>
268
- ^ ^ ^ ^ ^
269
- 1 2 3 4 5
270
-
271
- method argument
272
- --------------------------------------
273
- 1: on_xmldecl
274
- 2: on_xmldecl_version ("1.0")
275
- 3: on_xmldecl_encoding ("euc-jp")
276
- 4: on_xmldecl_standalone ("yes")
277
- 5: on_xmldecl_end
278
-
279
- XML�����ȯ��������硢on_xmldecl �� on_xmldecl_end ��ɬ��
280
- �ƤӽФ���ޤ���¾�Υ᥽�åɤ��б����빽ʸ��XML������
281
- ����ʤ��ä����ϸƤӽФ���ޤ���
282
-
283
- en| When an XML declaration is found, both on_xmldecl and
284
- en| on_xmldecl_end method are always called. Any other methods
285
- en| are called only when the corresponding syntaxes are found.
286
-
287
- on_xmldecl_other �� version, encoding, standalone �ʳ��������
288
- XML�������ˤ��ä����˸ƤӽФ���ޤ������Τ褦������Ϲ�ʸ��
289
- ������Ƥ��ʤ����ᡢon_xmldecl_other ���ƤӽФ�������ˤ�ɬ��
290
- ((<XMLScan::Visitor#parse_error>)) �᥽�åɤ��ƤӽФ���뤳�Ȥ�
291
- ���դ��Ʋ�������
292
-
293
- en| When a declaration except version, encoding, and standalone
294
- en| is found in an XML declaration, on_xmldecl_other method is
295
- en| called. Since such a declaration is not permitted, note that
296
- en| the parser always calls ((<XMLScan::Visitor#parse_error>)) method
297
- en| before calling on_xmldecl_other method.
298
-
299
- --- XMLScan::Visitor#on_doctype(root, pubid, sysid)
300
-
301
- ʸ�������ȯ���������˸ƤӽФ���ޤ���
302
-
303
- en| Called when the parser meets a document type declaration.
304
-
305
- document argument
306
- --------------------------------------------------------------
307
- 1: <!DOCTYPE foo> ('foo', nil, nil)
308
- 2: <!DOCTYPE foo SYSTEM "bar"> ('foo', nil, 'bar')
309
- 3: <!DOCTYPE foo PUBLIC "bar"> ('foo', 'bar', nil )
310
- 4: <!DOCTYPE foo PUBLIC "bar" "baz"> ('foo', 'bar', 'baz')
311
-
312
- --- XMLScan::Visitor#on_prolog_space(str)
313
-
314
- ���񤭤���˶����ȯ���������˸ƤӽФ���ޤ���
315
-
316
- en| Called when the parser meets whitespaces in prolog.
317
-
318
- --- XMLScan::Visitor#on_comment(str)
319
-
320
- �����Ȥ�ȯ���������˸ƤӽФ���ޤ���
321
-
322
- en| Called when the parser meets a comment.
323
-
324
- --- XMLScan::Visitor#on_pi(target, pi)
325
-
326
- ����̿���ȯ���������˸ƤӽФ���ޤ���
327
-
328
- en| Called when the parser meets a processing instruction.
329
-
330
- --- XMLScan::Visitor#on_chardata(str)
331
-
332
- ʸ���ǡ�����ȯ���������˸ƤӽФ���ޤ���
333
-
334
- en| Called when the parser meets character data.
335
-
336
- --- XMLScan::Visitor#on_cdata(str)
337
-
338
- CDATA����������ȯ���������˸ƤӽФ���ޤ���
339
-
340
- en| Called when the parser meets a CDATA section.
341
-
342
- --- XMLScan::Visitor#on_entityref(ref)
343
-
344
- °���ͤ���ʳ��ξ��ǰ��̼��λ��Ȥ�ȯ���������˸ƤӽФ���ޤ���
345
-
346
- en| Called when the parser meets a general entity reference
347
- en| in a place except an attribute value.
348
-
349
- --- XMLScan::Visitor#on_charref(code)
350
- --- XMLScan::Visitor#on_charref_hex(code)
351
-
352
- °���ͤ���ʳ��ξ���ʸ�����Ȥ�ȯ���������˸ƤӽФ���ޤ���
353
- ʸ�������ɤ�10�ʿ��ǻ��ꤵ��Ƥ������� on_charref��16�ʿ���
354
- ���ꤵ��Ƥ������� on_charref_hex ���ƤӽФ���ޤ���
355
- ((|code|))�������Ǥ���
356
-
357
- en| Called when the parser meets a character reference
358
- en| in a place except an attribute value.
359
- en| When the character code is represented by decimals,
360
- en| on_charref is called. When by hexadecimals, on_charref_hex
361
- en| is called. ((|code|)) is an integer.
362
-
363
- --- XMLScan::Visitor#on_stag(name)
364
- --- XMLScan::Visitor#on_attribute(name)
365
- --- XMLScan::Visitor#on_attr_value(str)
366
- --- XMLScan::Visitor#on_attr_entityref(ref)
367
- --- XMLScan::Visitor#on_attr_charref(code)
368
- --- XMLScan::Visitor#on_attr_charref_hex(code)
369
- --- XMLScan::Visitor#on_attribute_end(name)
370
- --- XMLScan::Visitor#on_stag_end_empty(name)
371
- --- XMLScan::Visitor#on_stag_end(name)
372
-
373
- ���ϥ�����ȯ���������˸ƤӽФ���ޤ���
374
-
375
- en| Called when the parser meets an XML declaration.
376
-
377
- <hoge fuga="foo&bar;&#38;&#x26;baz" >
378
- ^ ^ ^ ^ ^ ^ ^ ^ ^
379
- 1 2 3 4 5 6 7 8 9
380
-
381
- method argument
382
- ------------------------------------
383
- 1: on_stag ('hoge')
384
- 2: on_attribute ('fuga')
385
- 3: on_attr_value ('foo')
386
- 4: on_attr_entityref ('bar')
387
- 5: on_attr_charref (38)
388
- 6: on_attr_charref_hex (38)
389
- 7: on_attr_value ('baz')
390
- 8: on_attribute_end ('fuga')
391
- 9: on_stag_end ('hoge')
392
- or
393
- on_stag_end_empty ('hoge')
394
-
395
- ���ϥ�����ȯ��������硢on_stag �ȡ��б����� on_stag_end ����
396
- on_stag_end_empty ��ɬ���ƤӽФ���ޤ���¾�Υ᥽�åɤϡ����ϥ�����
397
- ���°��������ʤ��ä����ϸƤӽФ���ޤ���
398
-
399
- en| When a start tag is found, both on_stag and corresponding
400
- en| either on_stag_end or on_stag_end_empty method are always
401
- en| called. Any other methods are called only when at least one
402
- en| attribute is found in the start tag.
403
-
404
- °����ȯ��������硢on_attribute �� on_attribute_end ��ɬ��
405
- �ƤӽФ���ޤ���°���ͤ��� (fuga="") �λ��ϡ�����2�ĤΥ᥽�åɤΤߤ�
406
- �ƤӽФ���ޤ���
407
-
408
- en| When an attribute is found, both on_attribute and
409
- en| on_attribute_end method are always called. If the attribute
410
- en| value is empty, only these two methods are called.
411
-
412
- on_attr_entityref ��°���ͤ���ǰ��̼��λ��Ȥ�ȯ����������
413
- �ƤӽФ���ޤ���on_charref �ڤ� on_charref_hex ��°���ͤ����
414
- ʸ�����Ȥ�ȯ���������˸ƤӽФ���ޤ���
415
-
416
- en| When the parser meets a general entity reference in an
417
- en| attribute value, it calls on_attr_entityref method.
418
- en| When the parser meets a character reference in an attribute
419
- en| value, it calls either on_charref or on_charref_hex method.
420
-
421
- �����������ǥ������ä����ϡ�on_stag_end �᥽�åɤ������
422
- on_stag_end_empty �᥽�åɤ��ƤӽФ���ޤ���
423
-
424
- en| If the tag is an empty element tag, on_stag_end_empty method
425
- en| is called instead of on_stag_end method.
426
-
427
- --- XMLScan::Visitor#on_etag(name)
428
-
429
- ��λ������ȯ���������˸ƤӽФ���ޤ���
430
-
431
- en| Called when the parser meets an end tag.
432
-
433
-
434
-
435
- === XMLScan::XMLScanner
436
-
437
- XMLʸ��������Ϥ�����������ǧ�����륹����ʤǤ���
438
-
439
- en| The scanner which tokenizes an XML document and recognize tags,
440
- en| and so on.
441
-
442
- XMLScan::XMLScanner �ε���Ŭ�����ˤĤ��Ƥϡ�¾��ʸ��ǽҤ٤Ƥ��ޤ���
443
-
444
- en| The conformance of XMLScan::XMLScanner to the specification
445
- en| is described in another document.
446
-
447
- ==== �����ѡ����饹:
448
- en| ==== SuperClass:
449
-
450
- * Object
451
-
452
- ==== ���饹�᥽�å�:
453
- en| ==== Class Methods:
454
-
455
- --- XMLScan::XMLScanner.new(visitor[, option ...])
456
-
457
- XMLScan::XMLScanner ���֥������Ȥ��������ޤ���((|visitor|))��
458
- XMLScan::Visitor �Υ��󥹥��󥹤ǡ�XMLScan::XMLScanner ���֥������Ȥ���
459
- ���Ϸ�̤�������ޤ���
460
-
461
- en| Creates an instance. ((|visitor|)) is a instance of
462
- en| ((<XMLScan::Visitor>)) and receives the result of parsing
463
- en| from the XMLScan::Scanner object.
464
-
465
- ((|option|))��ʸ�������ϥ���ܥ�ǻ��ꤷ�ޤ���option�ˤ�
466
- ���Τ�Τ�����ޤ���
467
-
468
- en| You can specify one of more ((|option|)) as a string or symbol.
469
- en| XMLScan::Scanner's options are as follows:
470
-
471
- : 'strict_char'
472
-
473
- (({require 'xmlscan/xmlchar'})) ����Ȼ���Ǥ���褦�ˤʤ�ޤ���
474
- ������ʸ�����Ȥ��Ƥ��ʤ����ɤ����Υ����å���Ԥ��ޤ���
475
- �ѥե����ޥ󥹤��������㲼���ޤ���
476
-
477
- en| This option is enabled after
478
- en| (({require 'xmlscan/xmlchar'})).
479
- en| XMLScan::Scanner checks whether an XML document includes
480
- en| an illegal character. The performance decreases sharply.
481
-
482
- ==== �᥽�å�:
483
- en| ==== Methods:
484
-
485
- --- XMLScan::XMLScanner#kcode= arg
486
-
487
- CES����ꤷ�ޤ���((|arg|))�β��ϡ�nil ������� $KCODE ��Ʊ���Ǥ���
488
- ((|arg|))�� nil �ΤȤ��ϡ��ɤ� CES �Dz��Ϥ�Ԥ����� $KCODE ���ͤˤ�ä�
489
- ��ޤ�ޤ���
490
-
491
- en| Sets CES. Available values for ((|code|)) are same as $KCODE
492
- en| except nil. If ((|code|)) is nil, $KCODE decides the CES.
493
-
494
- --- XMLScan::XMLScanner#kcode
495
-
496
- �ɤ� CES �Dz��Ϥ�Ԥ����� Regexp#kcode ��Ʊ���������֤��ޤ���
497
- nil�ΤȤ���$KCODE�˰�¸���뤳�Ȥ�ɽ���ޤ���
498
-
499
- en| Returns CES. The format of the return value is same as
500
- en| Regexp#kcode. If this method returns nil, it represents that
501
- en| $KCODE decides the CES.
502
-
503
- --- XMLScan::XMLScanner#parse(source)
504
-
505
- ((|source|)) ��XMLʸ��Ȥ��Ʋ��Ϥ��ޤ���((|source|)) ��ʸ����
506
- ʸ������������� IO#gets ��Ʊ�������񤤤򤹤� gets �᥽�åɤ����
507
- ���֥������ȤǤʤ���Фʤ�ޤ���
508
-
509
- en| Parses ((|source|)) as an XML document. ((|source|)) must be
510
- en| a string, an array of strings, or an object which responds to
511
- en| gets method which behaves same as IO#gets does.
512
-
513
-
514
- === XMLScan::XMLParser
515
-
516
- �������򸡾ڤ��ʤ� XML parser �Ǥ���
517
-
518
- en| The non-validating XML parser.
519
-
520
- XMLScan::XMLParser �ε���Ŭ�����ˤĤ��Ƥϡ�¾��ʸ��ǽҤ٤Ƥ��ޤ���
521
-
522
- en| The conformance of XMLScan::XMLParser to the specification
523
- en| is described in another document.
524
-
525
-
526
- ==== �����ѡ����饹:
527
- en| ==== SuperClass:
528
-
529
- * ((<XMLScan::XMLScanner>))
530
-
531
- ==== ���饹�᥽�å�:
532
- en| ==== Class Methods:
533
-
534
- --- XMLScan::XMLParser.new(visitor[, option ...])
535
-
536
- XMLScan::XMLParser ���֥������Ȥ�((|visitor|))�γƥ᥽�åɤˤĤ��ơ�
537
- ���Τ��Ȥ��ݾڤ��ޤ���
538
-
539
- en| XMLScan::XMLParser makes sure the following for each
540
- en| method of ((|visitor|)):
541
-
542
- : ((<XMLScan::Visitor#on_stag>))
543
-
544
- ���Υ᥽�åɤ�ƤӽФ�����ˡ��б����� ((<XMLScan::Visitor#on_etag>))
545
- �᥽�åɤ�ɬ���ƤӽФ��ޤ���
546
-
547
- en| After calling this method, XMLScan::Parser always call
548
- en| corresponding ((<XMLScan::Visitor#on_etag>)) method.
549
-
550
- �ä��ơ����顼������Ԥ�ʤ���С���������XMLʸ��Ǥϵ��������ʤ�
551
- �᥽�åɸƤӽФ���������������ޤ���
552
-
553
- en| In addition, if you never intend error recovery, method calls
554
- en| which must not be occurred in a well-formed XML document are
555
- en| all suppressed.
556
-
557
-
558
- === XMLScan::HTMLScanner
559
-
560
- ((<XMLScan::XMLScanner>)) �򸵤ˤ��� HTML �ѡ����Ǥ���
561
-
562
- en| An HTML parser based on ((<XMLScan::XMLScanner>)).
563
-
564
- XMLScan::HTMLScanner �ε���Ŭ�����ˤĤ��Ƥϡ�¾��ʸ��ǽҤ٤Ƥ��ޤ���
565
-
566
- en| The conformance of XMLScan::HTMLScanner to the specification
567
- en| is described in another document.
568
-
569
- ==== �����ѡ����饹:
570
- en| ==== SuperClass:
571
-
572
- * ((<XMLScan::XMLScanner>))
573
-
574
- ==== ���饹�᥽�å�:
575
- en| ==== Class Methods:
576
-
577
- --- XMLScan::HTMLScanner.new(visitor[, option ...])
578
-
579
- XMLScan::HTMLScanner ���֥������Ȥ�((|visitor|))�γƥ᥽�åɤˤĤ��ơ�
580
- ���Τ��Ȥ��ݾڤ��ޤ���
581
-
582
- en| XMLScan::HTMLScanner makes sure the following for each
583
- en| method of ((|visitor|)):
584
-
585
- : ((<XMLScan::Visitor#on_xmldecl>))
586
- : ((<XMLScan::Visitor#on_xmldecl_version>))
587
- : ((<XMLScan::Visitor#on_xmldecl_encoding>))
588
- : ((<XMLScan::Visitor#on_xmldecl_standalone>))
589
- : ((<XMLScan::Visitor#on_xmldecl_end>))
590
-
591
- HTML �ˤ� XML�����¸�ߤ��ʤ��Τǡ������Υ᥽�åɤ�ƤӽФ����Ȥ�
592
- ����ޤ���
593
-
594
- en| An XML declaration never appears in an HTML document,
595
- en| so XMLScan::HTMLScanner never calls these methods.
596
-
597
- : ((<XMLScan::Visitor#on_stag_end_empty>))
598
-
599
- HTML �ˤ϶����ǥ�����¸�ߤ��ʤ��Τǡ����Υ᥽�åɤ�ƤӽФ����Ȥ�
600
- ����ޤ��󡣶����ǥ����ϲ��ϥ��顼�ˤʤ�ޤ���
601
-
602
- en| An empty element tag never appears in an HTML document,
603
- en| so XMLScan::HTMLScanner never calls this method.
604
- en| An empty element tag causes a parse error.
605
-
606
- : ((<XMLScan::Visitor#wellformed_error>))
607
-
608
- HTML �ˤ�����������¸�ߤ��ʤ��Τǡ����Υ᥽�åɤ�ƤӽФ����Ȥ�
609
- ����ޤ���
610
-
611
- en| There is no well-formedness constraint for HTML,
612
- en| so XMLScan::HTMLScanner never calls this method.
613
-
614
- =end