sdl4r 0.9.6 → 0.9.7
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +49 -2
- data/Rakefile +35 -5
- data/TODO +29 -3
- data/doc/classes/SDL4R.html +386 -674
- data/doc/classes/SDL4R/Parser.html +183 -307
- data/doc/classes/SDL4R/ParserTest.html +357 -0
- data/doc/classes/SDL4R/SDL4RTest.html +532 -0
- data/doc/classes/SDL4R/SDLTest.html +77 -0
- data/doc/classes/SDL4R/SdlBinary.html +180 -295
- data/doc/classes/SDL4R/SdlParseError.html +105 -180
- data/doc/classes/SDL4R/SdlTimeSpan.html +628 -939
- data/doc/classes/SDL4R/Tag.html +1236 -2036
- data/doc/classes/SDL4R/TagTest.html +292 -0
- data/doc/created.rid +1 -1
- data/doc/files/CHANGELOG.html +183 -184
- data/doc/files/LICENSE.html +496 -755
- data/doc/files/README.html +399 -623
- data/doc/files/lib/sdl4r/parser/reader_rb.html +53 -106
- data/doc/files/lib/sdl4r/parser/time_span_with_zone_rb.html +53 -106
- data/doc/files/lib/sdl4r/parser/token_rb.html +53 -106
- data/doc/files/lib/sdl4r/parser/tokenizer_rb.html +53 -106
- data/doc/files/lib/sdl4r/parser_rb.html +60 -112
- data/doc/files/lib/sdl4r/sdl4r_rb.html +62 -114
- data/doc/files/lib/sdl4r/sdl_binary_rb.html +53 -106
- data/doc/files/lib/sdl4r/sdl_parse_error_rb.html +53 -106
- data/doc/files/lib/sdl4r/sdl_time_span_rb.html +53 -106
- data/doc/files/lib/sdl4r/tag_rb.html +62 -114
- data/doc/files/lib/sdl4r_rb.html +53 -106
- data/doc/files/test/sdl4r/parser_test_rb.html +63 -0
- data/doc/files/test/sdl4r/sdl4r_test_rb.html +66 -0
- data/doc/files/test/sdl4r/sdl_test_rb.html +63 -0
- data/doc/files/test/sdl4r/tag_test_rb.html +63 -0
- data/doc/fr_class_index.html +19 -32
- data/doc/fr_file_index.html +37 -40
- data/doc/fr_method_index.html +4707 -114
- data/doc/index.html +14 -23
- data/doc/rdoc-style.css +323 -203
- data/lib/sdl4r/parser/reader.rb +26 -19
- data/lib/sdl4r/parser/token.rb +3 -3
- data/lib/sdl4r/parser/tokenizer.rb +93 -98
- data/lib/sdl4r/sdl_parse_error.rb +2 -2
- data/lib/sdl4r/tag.rb +127 -73
- data/test/sdl4r/parser_test.rb +109 -11
- data/test/sdl4r/tag_test.rb +73 -4
- metadata +15 -12
@@ -1,314 +1,190 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
<
|
7
|
-
<
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
</
|
45
|
-
<
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../../files/lib/sdl4r/parser_rb.html">
|
59
|
-
lib/sdl4r/parser.rb
|
60
|
-
</a>
|
61
|
-
<br />
|
62
|
-
<a href="../../files/lib/sdl4r/parser/reader_rb.html">
|
63
|
-
lib/sdl4r/parser/reader.rb
|
64
|
-
</a>
|
65
|
-
<br />
|
66
|
-
<a href="../../files/lib/sdl4r/parser/tokenizer_rb.html">
|
67
|
-
lib/sdl4r/parser/tokenizer.rb
|
68
|
-
</a>
|
69
|
-
<br />
|
70
|
-
<a href="../../files/lib/sdl4r/parser/token_rb.html">
|
71
|
-
lib/sdl4r/parser/token.rb
|
72
|
-
</a>
|
73
|
-
<br />
|
74
|
-
<a href="../../files/lib/sdl4r/parser/time_span_with_zone_rb.html">
|
75
|
-
lib/sdl4r/parser/time_span_with_zone.rb
|
76
|
-
</a>
|
77
|
-
<br />
|
78
|
-
</td>
|
79
|
-
</tr>
|
80
|
-
|
81
|
-
<tr class="top-aligned-row">
|
82
|
-
<td><strong>Parent:</strong></td>
|
83
|
-
<td>
|
84
|
-
Object
|
85
|
-
</td>
|
86
|
-
</tr>
|
87
|
-
</table>
|
88
|
-
</div>
|
89
|
-
<!-- banner header -->
|
90
|
-
|
91
|
-
<div id="bodyContent">
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
<div id="contextContent">
|
96
|
-
|
97
|
-
<div id="description">
|
98
|
-
<p>
|
99
|
-
The SDL parser.
|
100
|
-
</p>
|
101
|
-
<p>
|
102
|
-
In Ruby 1.8, in order to enable UTF-8 support, you may have to declare the
|
103
|
-
following lines:
|
104
|
-
</p>
|
105
|
-
<pre>
|
106
|
-
$KCODE = 'u'
|
107
|
-
require 'jcode'
|
108
|
-
</pre>
|
109
|
-
<p>
|
110
|
-
This will give you correct input and output and correct UTF-8
|
111
|
-
"general" sorting. Alternatively you can use the following
|
112
|
-
options when launching the Ruby interpreter:
|
113
|
-
</p>
|
114
|
-
<pre>
|
115
|
-
/path/to/ruby -Ku -rjcode
|
116
|
-
</pre>
|
117
|
-
<h2>Authors</h2>
|
118
|
-
<p>
|
119
|
-
Daniel Leuck, Philippe Vosges
|
120
|
-
</p>
|
121
|
-
|
122
|
-
</div>
|
123
|
-
|
124
|
-
|
125
|
-
</div>
|
126
|
-
|
127
|
-
<div id="method-list">
|
128
|
-
<h3 class="section-bar">Methods</h3>
|
129
|
-
|
130
|
-
<div class="name-list">
|
131
|
-
<a href="#M000010">new</a>
|
132
|
-
<a href="#M000012">new_date_time</a>
|
133
|
-
<a href="#M000011">parse</a>
|
134
|
-
</div>
|
135
|
-
</div>
|
136
|
-
|
137
|
-
</div>
|
138
|
-
|
139
|
-
|
140
|
-
<!-- if includes -->
|
141
|
-
|
142
|
-
<div id="section">
|
143
|
-
|
144
|
-
|
145
|
-
<div id="constants-list">
|
146
|
-
<h3 class="section-bar">Constants</h3>
|
147
|
-
|
148
|
-
<div class="name-list">
|
149
|
-
<table summary="Constants">
|
150
|
-
<tr class="top-aligned-row context-row">
|
151
|
-
<td class="context-item-name">UNKNOWN_POSITION</td>
|
152
|
-
<td>=</td>
|
153
|
-
<td class="context-item-value">-2</td>
|
154
|
-
<td width="3em"> </td>
|
155
|
-
<td class="context-item-desc">
|
156
|
-
Passed to parse_error() in order to specify an error that occured on no
|
157
|
-
specific position (column).
|
158
|
-
|
159
|
-
</td>
|
160
|
-
</tr>
|
161
|
-
</table>
|
162
|
-
</div>
|
163
|
-
</div>
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
<!-- if method_list -->
|
171
|
-
<div id="methods">
|
172
|
-
<h3 class="section-bar">Public Class methods</h3>
|
173
|
-
|
174
|
-
<div id="method-M000010" class="method-detail">
|
175
|
-
<a name="M000010"></a>
|
176
|
-
|
177
|
-
<div class="method-heading">
|
178
|
-
<a href="#M000010" class="method-signature">
|
179
|
-
<span class="method-name">new</span><span class="method-args">(io)</span>
|
180
|
-
</a>
|
181
|
-
</div>
|
182
|
-
|
183
|
-
<div class="method-description">
|
184
|
-
<p>
|
185
|
-
Creates an SDL parser on the specified <tt>IO</tt>.
|
186
|
-
</p>
|
187
|
-
<pre>
|
188
|
-
IO.open("path/to/sdl_file") { |io|
|
189
|
-
parser = SDL4R::Parser.new(io)
|
190
|
-
tags = parser.parse()
|
191
|
-
}
|
192
|
-
</pre>
|
193
|
-
<p><a class="source-toggle" href="#"
|
194
|
-
onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
|
195
|
-
<div class="method-source-code" id="M000010-source">
|
196
|
-
<pre>
|
197
|
-
<span class="ruby-comment cmt"># File lib/sdl4r/parser.rb, line 59</span>
|
198
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">io</span>)
|
199
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"io == nil"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">io</span>.<span class="ruby-identifier">nil?</span>
|
200
|
-
|
201
|
-
<span class="ruby-ivar">@tokenizer</span> = <span class="ruby-constant">Tokenizer</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">io</span>)
|
202
|
-
<span class="ruby-keyword kw">end</span>
|
203
|
-
</pre>
|
204
|
-
</div>
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
2
|
+
<html lang='en'>
|
3
|
+
<head>
|
4
|
+
<title>: SDL4R::Parser [RDoc: Simple Declarative Language for Ruby]</title>
|
5
|
+
<meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
|
6
|
+
<link href='../../rdoc-style.css' media='screen' rel='stylesheet' type='text/css'>
|
7
|
+
<script type='text/javascript'>
|
8
|
+
//<![CDATA[
|
9
|
+
function popupCode(url) {
|
10
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
11
|
+
}
|
12
|
+
|
13
|
+
function toggleCode(id) {
|
14
|
+
var code = document.getElementById(id)
|
15
|
+
|
16
|
+
code.style.display = code.style.display != 'block' ? 'block' : 'none'
|
17
|
+
return true
|
18
|
+
}
|
19
|
+
|
20
|
+
// Make codeblocks hidden by default
|
21
|
+
document.writeln('<' + 'style type="text/css">.method .source pre { display: none }<\/style>')
|
22
|
+
//]]>
|
23
|
+
</script>
|
24
|
+
</head>
|
25
|
+
<body class='page'>
|
26
|
+
<div class='class' id='wrapper'>
|
27
|
+
<div class='header'>
|
28
|
+
<h1 class='name'>
|
29
|
+
<span class='type'>Class</span>
|
30
|
+
SDL4R::Parser
|
31
|
+
</h1>
|
32
|
+
<ol class='paths'>
|
33
|
+
<li>
|
34
|
+
<a href="../../files/lib/sdl4r/parser_rb.html">lib/sdl4r/parser.rb</a>
|
35
|
+
</li>
|
36
|
+
<li class='other'>
|
37
|
+
<a href="../../files/lib/sdl4r/parser/reader_rb.html">lib/sdl4r/parser/reader.rb</a>
|
38
|
+
</li>
|
39
|
+
<li class='other'>
|
40
|
+
<a href="../../files/lib/sdl4r/parser/tokenizer_rb.html">lib/sdl4r/parser/tokenizer.rb</a>
|
41
|
+
</li>
|
42
|
+
<li class='other'>
|
43
|
+
<a href="../../files/lib/sdl4r/parser/token_rb.html">lib/sdl4r/parser/token.rb</a>
|
44
|
+
</li>
|
45
|
+
<li class='other'>
|
46
|
+
<a href="../../files/lib/sdl4r/parser/time_span_with_zone_rb.html">lib/sdl4r/parser/time_span_with_zone.rb</a>
|
47
|
+
</li>
|
48
|
+
<li>
|
49
|
+
<a class='show' href='#' onclick='this.parentNode.parentNode.className += " expanded"; this.parentNode.removeChild(this); return false'>show all</a>
|
50
|
+
</li>
|
51
|
+
</ol>
|
52
|
+
<div class='parent'>
|
53
|
+
Parent:
|
54
|
+
<strong>Object</strong>
|
205
55
|
</div>
|
206
56
|
</div>
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
</
|
224
|
-
<
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
</pre>
|
229
|
-
<p><a class="source-toggle" href="#"
|
230
|
-
onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
|
231
|
-
<div class="method-source-code" id="M000012-source">
|
232
|
-
<pre>
|
233
|
-
<span class="ruby-comment cmt"># File lib/sdl4r/parser.rb, line 105</span>
|
234
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">new_date_time</span>(<span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">time_zone_offset</span>)
|
235
|
-
<span class="ruby-constant">SDL4R</span><span class="ruby-operator">::</span><span class="ruby-identifier">new_date_time</span>(<span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">time_zone_offset</span>)
|
236
|
-
<span class="ruby-keyword kw">end</span>
|
237
|
-
</pre>
|
57
|
+
<div id='content'>
|
58
|
+
<div id='text'>
|
59
|
+
<div id='description'>
|
60
|
+
<p>
|
61
|
+
The SDL parser.
|
62
|
+
</p>
|
63
|
+
<p>
|
64
|
+
In Ruby 1.8, in order to enable UTF-8 support, you may have to declare the
|
65
|
+
following lines:
|
66
|
+
</p>
|
67
|
+
<pre>$KCODE = 'u'
require 'jcode'</pre>
|
68
|
+
<p>
|
69
|
+
This will give you correct input and output and correct UTF-8
|
70
|
+
“general” sorting. Alternatively you can use the following
|
71
|
+
options when launching the Ruby interpreter:
|
72
|
+
</p>
|
73
|
+
<pre>/path/to/ruby -Ku -rjcode</pre>
|
74
|
+
<h2>Authors</h2>
|
75
|
+
<p>
|
76
|
+
Daniel Leuck, Philippe Vosges
|
77
|
+
</p>
|
238
78
|
</div>
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
<
|
257
|
-
<
|
258
|
-
<
|
259
|
-
|
260
|
-
|
261
|
-
<
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
</
|
79
|
+
<div id='method-list'>
|
80
|
+
<h2>Methods</h2>
|
81
|
+
<h3>public class</h3>
|
82
|
+
<ol>
|
83
|
+
<li><a href="#M000081">new</a></li>
|
84
|
+
</ol>
|
85
|
+
<h3>public instance</h3>
|
86
|
+
<ol>
|
87
|
+
<li><a href="#M000083">new_date_time</a></li>
|
88
|
+
<li><a href="#M000082">parse</a></li>
|
89
|
+
</ol>
|
90
|
+
</div>
|
91
|
+
<div id='section'>
|
92
|
+
<div id='constants-list'>
|
93
|
+
<h2>Constants</h2>
|
94
|
+
<div class='name-list'>
|
95
|
+
<table summary='Constants'>
|
96
|
+
<tr class='top-aligned-row context-row'>
|
97
|
+
<td class='context-item-name'>UNKNOWN_POSITION</td>
|
98
|
+
<td>=</td>
|
99
|
+
<td class='context-item-value'>-2</td>
|
100
|
+
<td> </td>
|
101
|
+
<td class='context-item-desc'>
|
102
|
+
|
103
|
+
Passed to parse_error() in order to specify an error that occured on no
|
104
|
+
specific position (column).
|
105
|
+
</td>
|
106
|
+
</tr>
|
107
|
+
</table>
|
108
|
+
</div>
|
109
|
+
</div>
|
110
|
+
<div id='methods'>
|
111
|
+
<h2>Public class methods</h2>
|
112
|
+
<div class='method public-class' id='method-M000081'>
|
113
|
+
<a name='M000081'></a>
|
114
|
+
<div class='synopsis'>
|
115
|
+
<span class='name'>new</span>
|
116
|
+
<span class='arguments'>(io)</span>
|
117
|
+
</div>
|
118
|
+
<div class='description'>
|
119
|
+
<p>
|
120
|
+
Creates an SDL parser on the specified <tt>IO</tt>.
|
121
|
+
</p>
|
122
|
+
<pre>IO.open("path/to/sdl_file") { |io|
 parser = SDL4R::Parser.new(io)
 tags = parser.parse()
}</pre>
|
123
|
+
</div>
|
124
|
+
<div class='source'>
|
125
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000081-source'); return false">
|
126
|
+
[show source]
|
127
|
+
</a>
|
128
|
+
<pre id='M000081-source'> <span class="ruby-comment cmt"># File lib/sdl4r/parser.rb, line 59</span>
59: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">io</span>)
60: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"io == nil"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">io</span>.<span class="ruby-identifier">nil?</span>
61: 
62: <span class="ruby-ivar">@tokenizer</span> = <span class="ruby-constant">Tokenizer</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">io</span>)
63: <span class="ruby-keyword kw">end</span></pre>
|
129
|
+
</div>
|
130
|
+
</div>
|
131
|
+
<h2>Public instance methods</h2>
|
132
|
+
<div class='method public-instance' id='method-M000083'>
|
133
|
+
<a name='M000083'></a>
|
134
|
+
<div class='synopsis'>
|
135
|
+
<span class='name'>new_date_time</span>
|
136
|
+
<span class='arguments'>(year, month, day, hour, min, sec, time_zone_offset)</span>
|
137
|
+
</div>
|
138
|
+
<div class='description'>
|
139
|
+
<p>
|
140
|
+
Creates and returns the object representing a datetime (DateTime in the
|
141
|
+
default implementation). Can be overriden.
|
142
|
+
</p>
|
143
|
+
<pre>def new_date_time(year, month, day, hour, min, sec, time_zone_offset)
 Time.utc(year, month, day, hour, min, sec)
end</pre>
|
144
|
+
</div>
|
145
|
+
<div class='source'>
|
146
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000083-source'); return false">
|
147
|
+
[show source]
|
148
|
+
</a>
|
149
|
+
<pre id='M000083-source'> <span class="ruby-comment cmt"># File lib/sdl4r/parser.rb, line 105</span>
105: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">new_date_time</span>(<span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">time_zone_offset</span>)
106: <span class="ruby-constant">SDL4R</span><span class="ruby-operator">::</span><span class="ruby-identifier">new_date_time</span>(<span class="ruby-identifier">year</span>, <span class="ruby-identifier">month</span>, <span class="ruby-identifier">day</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">time_zone_offset</span>)
107: <span class="ruby-keyword kw">end</span></pre>
|
150
|
+
</div>
|
151
|
+
</div>
|
152
|
+
<div class='method public-instance' id='method-M000082'>
|
153
|
+
<a name='M000082'></a>
|
154
|
+
<div class='synopsis'>
|
155
|
+
<span class='name'>parse</span>
|
156
|
+
<span class='arguments'>()</span>
|
157
|
+
</div>
|
158
|
+
<div class='description'>
|
159
|
+
<p>
|
160
|
+
Parses the underlying <tt>IO</tt> and returns an <tt>Array</tt> of
|
161
|
+
<tt>Tag</tt>.
|
162
|
+
</p>
|
163
|
+
<h2>Errors</h2>
|
164
|
+
<dl>
|
165
|
+
<dt>IOError</dt><dd>If a problem is encountered with the IO
|
166
|
+
|
167
|
+
</dd>
|
168
|
+
<dt><a href="SdlParseError.html">SdlParseError</a></dt><dd>If the document is malformed
|
169
|
+
|
170
|
+
</dd>
|
171
|
+
</dl>
|
172
|
+
</div>
|
173
|
+
<div class='source'>
|
174
|
+
<a class='source-toggle' href='#' onclick="toggleCode('M000082-source'); return false">
|
175
|
+
[show source]
|
176
|
+
</a>
|
177
|
+
<pre id='M000082-source'> <span class="ruby-comment cmt"># File lib/sdl4r/parser.rb, line 70</span>
70: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse</span>
71: <span class="ruby-identifier">tags</span> = []
72: 
73: <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">tokens</span> = <span class="ruby-ivar">@tokenizer</span>.<span class="ruby-identifier">read_line_tokens</span>()
74: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">tokens</span>.<span class="ruby-identifier">last</span>.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:START_BLOCK</span>
75: <span class="ruby-comment cmt"># tag with a block</span>
76: <span class="ruby-identifier">tag</span> = <span class="ruby-identifier">construct_tag</span>(<span class="ruby-identifier">tokens</span>[<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-value">-1</span>])
77: <span class="ruby-identifier">add_children</span>(<span class="ruby-identifier">tag</span>)
78: <span class="ruby-identifier">tags</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">tag</span>
79: 
80: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">tokens</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:END_BLOCK</span>
81: <span class="ruby-comment cmt"># we found an block end token that should have been consumed by</span>
82: <span class="ruby-comment cmt"># add_children() normally</span>
83: <span class="ruby-identifier">parse_error</span>(
84: <span class="ruby-value str">"No opening block ({) for close block (})."</span>,
85: <span class="ruby-identifier">tokens</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">line</span>,
86: <span class="ruby-identifier">tokens</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">position</span>)
87: <span class="ruby-keyword kw">else</span>
88: <span class="ruby-comment cmt"># tag without block</span>
89: <span class="ruby-identifier">tags</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">construct_tag</span>(<span class="ruby-identifier">tokens</span>)
90: <span class="ruby-keyword kw">end</span>
91: <span class="ruby-keyword kw">end</span>
92: 
93: <span class="ruby-ivar">@tokenizer</span>.<span class="ruby-identifier">close</span>()
94: 
95: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">tags</span>
96: <span class="ruby-keyword kw">end</span></pre>
|
178
|
+
</div>
|
179
|
+
</div>
|
180
|
+
</div>
|
298
181
|
</div>
|
299
182
|
</div>
|
300
183
|
</div>
|
301
|
-
|
302
|
-
|
184
|
+
<div id='footer-push'></div>
|
185
|
+
</div>
|
186
|
+
<div id='footer'>
|
187
|
+
<a href="http://github.com/mislav/hanna/tree/master"><strong>Hanna</strong> RDoc template</a>
|
303
188
|
</div>
|
304
|
-
|
305
|
-
|
306
|
-
</div>
|
307
|
-
|
308
|
-
|
309
|
-
<div id="validator-badges">
|
310
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
311
|
-
</div>
|
312
|
-
|
313
|
-
</body>
|
314
|
-
</html>
|
189
|
+
</body>
|
190
|
+
</html>
|