sdl4r 0.9.6 → 0.9.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. data/CHANGELOG +49 -2
  2. data/Rakefile +35 -5
  3. data/TODO +29 -3
  4. data/doc/classes/SDL4R.html +386 -674
  5. data/doc/classes/SDL4R/Parser.html +183 -307
  6. data/doc/classes/SDL4R/ParserTest.html +357 -0
  7. data/doc/classes/SDL4R/SDL4RTest.html +532 -0
  8. data/doc/classes/SDL4R/SDLTest.html +77 -0
  9. data/doc/classes/SDL4R/SdlBinary.html +180 -295
  10. data/doc/classes/SDL4R/SdlParseError.html +105 -180
  11. data/doc/classes/SDL4R/SdlTimeSpan.html +628 -939
  12. data/doc/classes/SDL4R/Tag.html +1236 -2036
  13. data/doc/classes/SDL4R/TagTest.html +292 -0
  14. data/doc/created.rid +1 -1
  15. data/doc/files/CHANGELOG.html +183 -184
  16. data/doc/files/LICENSE.html +496 -755
  17. data/doc/files/README.html +399 -623
  18. data/doc/files/lib/sdl4r/parser/reader_rb.html +53 -106
  19. data/doc/files/lib/sdl4r/parser/time_span_with_zone_rb.html +53 -106
  20. data/doc/files/lib/sdl4r/parser/token_rb.html +53 -106
  21. data/doc/files/lib/sdl4r/parser/tokenizer_rb.html +53 -106
  22. data/doc/files/lib/sdl4r/parser_rb.html +60 -112
  23. data/doc/files/lib/sdl4r/sdl4r_rb.html +62 -114
  24. data/doc/files/lib/sdl4r/sdl_binary_rb.html +53 -106
  25. data/doc/files/lib/sdl4r/sdl_parse_error_rb.html +53 -106
  26. data/doc/files/lib/sdl4r/sdl_time_span_rb.html +53 -106
  27. data/doc/files/lib/sdl4r/tag_rb.html +62 -114
  28. data/doc/files/lib/sdl4r_rb.html +53 -106
  29. data/doc/files/test/sdl4r/parser_test_rb.html +63 -0
  30. data/doc/files/test/sdl4r/sdl4r_test_rb.html +66 -0
  31. data/doc/files/test/sdl4r/sdl_test_rb.html +63 -0
  32. data/doc/files/test/sdl4r/tag_test_rb.html +63 -0
  33. data/doc/fr_class_index.html +19 -32
  34. data/doc/fr_file_index.html +37 -40
  35. data/doc/fr_method_index.html +4707 -114
  36. data/doc/index.html +14 -23
  37. data/doc/rdoc-style.css +323 -203
  38. data/lib/sdl4r/parser/reader.rb +26 -19
  39. data/lib/sdl4r/parser/token.rb +3 -3
  40. data/lib/sdl4r/parser/tokenizer.rb +93 -98
  41. data/lib/sdl4r/sdl_parse_error.rb +2 -2
  42. data/lib/sdl4r/tag.rb +127 -73
  43. data/test/sdl4r/parser_test.rb +109 -11
  44. data/test/sdl4r/tag_test.rb +73 -4
  45. metadata +15 -12
@@ -1,314 +1,190 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!DOCTYPE html
3
- PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
6
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
- <head>
8
- <title>Class: SDL4R::Parser</title>
9
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
10
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
- <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
12
- <script type="text/javascript">
13
- // <![CDATA[
14
-
15
- function popupCode( url ) {
16
- window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
- }
18
-
19
- function toggleCode( id ) {
20
- if ( document.getElementById )
21
- elem = document.getElementById( id );
22
- else if ( document.all )
23
- elem = eval( "document.all." + id );
24
- else
25
- return false;
26
-
27
- elemStyle = elem.style;
28
-
29
- if ( elemStyle.display != "block" ) {
30
- elemStyle.display = "block"
31
- } else {
32
- elemStyle.display = "none"
33
- }
34
-
35
- return true;
36
- }
37
-
38
- // Make codeblocks hidden by default
39
- document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
-
41
- // ]]>
42
- </script>
43
-
44
- </head>
45
- <body>
46
-
47
-
48
-
49
- <div id="classHeader">
50
- <table class="header-table">
51
- <tr class="top-aligned-row">
52
- <td><strong>Class</strong></td>
53
- <td class="class-name-in-header">SDL4R::Parser</td>
54
- </tr>
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
- &quot;general&quot; 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>&nbsp;&nbsp;
132
- <a href="#M000012">new_date_time</a>&nbsp;&nbsp;
133
- <a href="#M000011">parse</a>&nbsp;&nbsp;
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">&nbsp;</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(&quot;path/to/sdl_file&quot;) { |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">&quot;io == nil&quot;</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
- <h3 class="section-bar">Public Instance methods</h3>
209
-
210
- <div id="method-M000012" class="method-detail">
211
- <a name="M000012"></a>
212
-
213
- <div class="method-heading">
214
- <a href="#M000012" class="method-signature">
215
- <span class="method-name">new_date_time</span><span class="method-args">(year, month, day, hour, min, sec, time_zone_offset)</span>
216
- </a>
217
- </div>
218
-
219
- <div class="method-description">
220
- <p>
221
- Creates and returns the object representing a datetime (DateTime in the
222
- default implementation). Can be overriden.
223
- </p>
224
- <pre>
225
- def new_date_time(year, month, day, hour, min, sec, time_zone_offset)
226
- Time.utc(year, month, day, hour, min, sec)
227
- end
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'&#x000A;require 'jcode'</pre>
68
+ <p>
69
+ This will give you correct input and output and correct UTF-8
70
+ &#8220;general&#8221; 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
- </div>
240
- </div>
241
-
242
- <div id="method-M000011" class="method-detail">
243
- <a name="M000011"></a>
244
-
245
- <div class="method-heading">
246
- <a href="#M000011" class="method-signature">
247
- <span class="method-name">parse</span><span class="method-args">()</span>
248
- </a>
249
- </div>
250
-
251
- <div class="method-description">
252
- <p>
253
- Parses the underlying <tt>IO</tt> and returns an <tt>Array</tt> of <tt><a
254
- href="Tag.html">Tag</a></tt>.
255
- </p>
256
- <h2>Errors</h2>
257
- <dl>
258
- <dt>IOError</dt><dd>If a problem is encountered with the IO
259
-
260
- </dd>
261
- <dt><a href="SdlParseError.html">SdlParseError</a></dt><dd>If the document is malformed
262
-
263
- </dd>
264
- </dl>
265
- <p><a class="source-toggle" href="#"
266
- onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
267
- <div class="method-source-code" id="M000011-source">
268
- <pre>
269
- <span class="ruby-comment cmt"># File lib/sdl4r/parser.rb, line 70</span>
270
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse</span>
271
- <span class="ruby-identifier">tags</span> = []
272
-
273
- <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>()
274
- <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>
275
- <span class="ruby-comment cmt"># tag with a block</span>
276
- <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>])
277
- <span class="ruby-identifier">add_children</span>(<span class="ruby-identifier">tag</span>)
278
- <span class="ruby-identifier">tags</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">tag</span>
279
-
280
- <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>
281
- <span class="ruby-comment cmt"># we found an block end token that should have been consumed by</span>
282
- <span class="ruby-comment cmt"># add_children() normally</span>
283
- <span class="ruby-identifier">parse_error</span>(
284
- <span class="ruby-value str">&quot;No opening block ({) for close block (}).&quot;</span>,
285
- <span class="ruby-identifier">tokens</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">line</span>,
286
- <span class="ruby-identifier">tokens</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">position</span>)
287
- <span class="ruby-keyword kw">else</span>
288
- <span class="ruby-comment cmt"># tag without block</span>
289
- <span class="ruby-identifier">tags</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">construct_tag</span>(<span class="ruby-identifier">tokens</span>)
290
- <span class="ruby-keyword kw">end</span>
291
- <span class="ruby-keyword kw">end</span>
292
-
293
- <span class="ruby-ivar">@tokenizer</span>.<span class="ruby-identifier">close</span>()
294
-
295
- <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">tags</span>
296
- <span class="ruby-keyword kw">end</span>
297
- </pre>
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>&nbsp;</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(&quot;path/to/sdl_file&quot;) { |io|&#x000A; parser = SDL4R::Parser.new(io)&#x000A; tags = parser.parse()&#x000A;}</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>&#x000A;59: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">io</span>)&#x000A;60: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">&quot;io == nil&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">io</span>.<span class="ruby-identifier">nil?</span>&#x000A;61: &#x000A;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>)&#x000A;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)&#x000A; Time.utc(year, month, day, hour, min, sec)&#x000A;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>&#x000A;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>)&#x000A;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>)&#x000A;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>&#x000A;70: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse</span>&#x000A;71: <span class="ruby-identifier">tags</span> = []&#x000A;72: &#x000A;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>()&#x000A;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>&#x000A;75: <span class="ruby-comment cmt"># tag with a block</span>&#x000A;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>])&#x000A;77: <span class="ruby-identifier">add_children</span>(<span class="ruby-identifier">tag</span>)&#x000A;78: <span class="ruby-identifier">tags</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">tag</span>&#x000A;79: &#x000A;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>&#x000A;81: <span class="ruby-comment cmt"># we found an block end token that should have been consumed by</span>&#x000A;82: <span class="ruby-comment cmt"># add_children() normally</span>&#x000A;83: <span class="ruby-identifier">parse_error</span>(&#x000A;84: <span class="ruby-value str">&quot;No opening block ({) for close block (}).&quot;</span>,&#x000A;85: <span class="ruby-identifier">tokens</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">line</span>,&#x000A;86: <span class="ruby-identifier">tokens</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">position</span>)&#x000A;87: <span class="ruby-keyword kw">else</span>&#x000A;88: <span class="ruby-comment cmt"># tag without block</span>&#x000A;89: <span class="ruby-identifier">tags</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">construct_tag</span>(<span class="ruby-identifier">tokens</span>)&#x000A;90: <span class="ruby-keyword kw">end</span>&#x000A;91: <span class="ruby-keyword kw">end</span>&#x000A;92: &#x000A;93: <span class="ruby-ivar">@tokenizer</span>.<span class="ruby-identifier">close</span>()&#x000A;94: &#x000A;95: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">tags</span>&#x000A;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>