kwartz 3.0.0 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +36 -1
- data/LGPL +504 -0
- data/README.txt +16 -2
- data/bin/kwartz +1 -1
- data/doc-api/classes/Kwartz.html +47 -1
- data/doc-api/classes/Kwartz/Assertion.html +6 -6
- data/doc-api/classes/Kwartz/AssertionError.html +6 -6
- data/doc-api/classes/Kwartz/AttrInfo.html +42 -42
- data/doc-api/classes/Kwartz/BaseError.html +12 -12
- data/doc-api/classes/Kwartz/BaseTranslator.html +210 -43
- data/doc-api/classes/Kwartz/CharacterType.html +24 -24
- data/doc-api/classes/Kwartz/CommandOptionError.html +7 -7
- data/doc-api/classes/Kwartz/CommandOptions.html +49 -49
- data/doc-api/classes/Kwartz/Config.html +6 -1
- data/doc-api/classes/Kwartz/ConvertError.html +14 -14
- data/doc-api/classes/Kwartz/Converter.html +31 -30
- data/doc-api/classes/Kwartz/CssStyleParser.html +79 -57
- data/doc-api/classes/Kwartz/Defun.html +313 -0
- data/doc-api/classes/Kwartz/DocumentRuleset.html +58 -58
- data/doc-api/classes/Kwartz/ElementExpander.html +32 -32
- data/doc-api/classes/Kwartz/ElementInfo.html +29 -29
- data/doc-api/classes/Kwartz/ElementRuleset.html +126 -96
- data/doc-api/classes/Kwartz/EperlHandler.html +108 -84
- data/doc-api/classes/Kwartz/EperlTranslator.html +7 -7
- data/doc-api/classes/Kwartz/ErubisHandler.html +2 -2
- data/doc-api/classes/Kwartz/ErubisTranslator.html +8 -8
- data/doc-api/classes/Kwartz/ErubyHandler.html +2 -220
- data/doc-api/classes/Kwartz/ErubyTranslator.html +7 -7
- data/doc-api/classes/Kwartz/ExpandStatement.html +20 -20
- data/doc-api/classes/Kwartz/Handler.html +122 -117
- data/doc-api/classes/Kwartz/HandlerArgument.html +215 -0
- data/doc-api/classes/Kwartz/Helper.html +112 -0
- data/doc-api/classes/Kwartz/Helper/ActionViewHelper.html +221 -0
- data/doc-api/classes/Kwartz/Helper/RailsTemplate.html +630 -0
- data/doc-api/classes/Kwartz/JstlHandler.html +208 -193
- data/doc-api/classes/Kwartz/JstlTranslator.html +15 -15
- data/doc-api/classes/Kwartz/KwartzError.html +6 -6
- data/doc-api/classes/Kwartz/Main.html +39 -23
- data/doc-api/classes/Kwartz/NativeExpression.html +18 -18
- data/doc-api/classes/Kwartz/NativeStatement.html +25 -25
- data/doc-api/classes/Kwartz/Node.html +6 -6
- data/doc-api/classes/Kwartz/PIErubisHandler.html +113 -0
- data/doc-api/classes/Kwartz/PIErubisTranslator.html +200 -0
- data/doc-api/classes/Kwartz/ParseError.html +6 -6
- data/doc-api/classes/Kwartz/PhpHandler.html +102 -83
- data/doc-api/classes/Kwartz/PhpTranslator.html +14 -14
- data/doc-api/classes/Kwartz/PresentationLogicParser.html +136 -128
- data/doc-api/classes/Kwartz/PrintStatement.html +19 -19
- data/doc-api/classes/Kwartz/RailsHandler.html +121 -118
- data/doc-api/classes/Kwartz/RailsTranslator.html +7 -7
- data/doc-api/classes/Kwartz/RubyHandler.html +349 -0
- data/doc-api/classes/Kwartz/RubyStyleParser.html +85 -85
- data/doc-api/classes/Kwartz/RubyTranslator.html +218 -0
- data/doc-api/classes/Kwartz/StatementHelper.html +479 -0
- data/doc-api/classes/Kwartz/StrutsTranslator.html +12 -12
- data/doc-api/classes/Kwartz/TagInfo.html +28 -28
- data/doc-api/classes/Kwartz/TextConverter.html +28 -28
- data/doc-api/classes/Kwartz/Translator.html +42 -42
- data/doc-api/classes/Kwartz/Util.html +284 -0
- data/doc-api/created.rid +1 -1
- data/doc-api/files/__/README_txt.html +30 -3
- data/doc-api/files/kwartz/assert_rb.html +1 -1
- data/doc-api/files/kwartz/binding/eperl_rb.html +2 -2
- data/doc-api/files/kwartz/binding/erubis_rb.html +3 -3
- data/doc-api/files/kwartz/binding/eruby_rb.html +3 -2
- data/doc-api/files/kwartz/binding/jstl_rb.html +2 -2
- data/doc-api/files/kwartz/binding/php_rb.html +2 -2
- data/doc-api/files/kwartz/binding/pierubis_rb.html +116 -0
- data/doc-api/files/kwartz/binding/rails_rb.html +2 -2
- data/doc-api/files/kwartz/binding/ruby_rb.html +115 -0
- data/doc-api/files/kwartz/binding/struts_rb.html +1 -1
- data/doc-api/files/kwartz/config_rb.html +2 -2
- data/doc-api/files/kwartz/converter_rb.html +3 -2
- data/doc-api/files/kwartz/defun_rb.html +116 -0
- data/doc-api/files/kwartz/error_rb.html +1 -1
- data/doc-api/files/kwartz/helper/rails_rb.html +123 -0
- data/doc-api/files/kwartz/main_rb.html +5 -2
- data/doc-api/files/kwartz/node_rb.html +2 -2
- data/doc-api/files/kwartz/parser_rb.html +2 -2
- data/doc-api/files/kwartz/translator_rb.html +2 -2
- data/doc-api/files/kwartz/util/assert-text-equal_rb.html +1 -1
- data/doc-api/files/kwartz/util/testcase-helper_rb.html +2 -2
- data/doc-api/files/kwartz/util_rb.html +107 -0
- data/doc-api/files/kwartz_rb.html +3 -2
- data/doc-api/fr_class_index.html +11 -0
- data/doc-api/fr_file_index.html +5 -0
- data/doc-api/fr_method_index.html +242 -190
- data/doc/p-pattern.html +94 -94
- data/doc/reference.html +847 -612
- data/doc/users-guide.html +744 -241
- data/examples/rails1/README +2 -2
- data/examples/rails1/application_helper.rb +2 -27
- data/examples/rails1/link_to.plogic +5 -5
- data/examples/rails1/list.plogic +2 -2
- data/examples/rails2/app/controllers/application.rb +14 -0
- data/examples/rails2/app/controllers/groups_controller.rb +47 -0
- data/examples/rails2/app/controllers/members_controller.rb +56 -0
- data/examples/rails2/app/helpers/application_helper.rb +6 -0
- data/examples/rails2/app/helpers/groups_helper.rb +2 -0
- data/examples/rails2/app/helpers/members_helper.rb +2 -0
- data/examples/rails2/app/models/group.rb +2 -0
- data/examples/rails2/app/models/member.rb +3 -0
- data/examples/rails2/app/views/groups/_form.html +30 -0
- data/examples/rails2/app/views/groups/_form.plogic +11 -0
- data/examples/rails2/app/views/groups/_link.plogic +19 -0
- data/examples/rails2/app/views/groups/_read.plogic +7 -0
- data/examples/rails2/app/views/groups/edit.cfg.yaml +2 -0
- data/examples/rails2/app/views/groups/edit.html +26 -0
- data/examples/rails2/app/views/groups/edit.plogic +9 -0
- data/examples/rails2/app/views/groups/list.html +48 -0
- data/examples/rails2/app/views/groups/list.plogic +32 -0
- data/examples/rails2/app/views/groups/new.cfg.yaml +2 -0
- data/examples/rails2/app/views/groups/new.html +27 -0
- data/examples/rails2/app/views/groups/new.plogic +9 -0
- data/examples/rails2/app/views/groups/show.html +27 -0
- data/examples/rails2/app/views/groups/show.plogic +2 -0
- data/examples/rails2/app/views/layouts/groups.html +23 -0
- data/examples/rails2/app/views/layouts/groups.plogic +11 -0
- data/examples/rails2/app/views/layouts/members.html +23 -0
- data/examples/rails2/app/views/layouts/members.plogic +11 -0
- data/examples/rails2/app/views/layouts/members2.html +24 -0
- data/examples/rails2/app/views/layouts/members2.plogic +11 -0
- data/examples/rails2/app/views/members/_form.plogic +27 -0
- data/examples/rails2/app/views/members/_link.plogic +19 -0
- data/examples/rails2/app/views/members/_read.plogic +29 -0
- data/examples/rails2/app/views/members/edit.cfg.yaml +6 -0
- data/examples/rails2/app/views/members/edit.html +27 -0
- data/examples/rails2/app/views/members/edit.plogic +10 -0
- data/examples/rails2/app/views/members/list.html +53 -0
- data/examples/rails2/app/views/members/list.plogic +32 -0
- data/examples/rails2/app/views/members/new.html +61 -0
- data/examples/rails2/app/views/members/new.plogic +17 -0
- data/examples/rails2/app/views/members/show.html +41 -0
- data/examples/rails2/app/views/members/show.plogic +3 -0
- data/examples/rails2/db/create-tables.mysql.sql +27 -0
- data/examples/rails2/db/create-tables.pgsql.sql +27 -0
- data/examples/rails2/db/insert-data.sql +21 -0
- data/examples/rails2/db/tabledef.yaml +51 -0
- data/kwartz.gemspec +4 -4
- data/lib/kwartz.rb +10 -2
- data/lib/kwartz/assert.rb +1 -1
- data/lib/kwartz/binding/eperl.rb +85 -61
- data/lib/kwartz/binding/erubis.rb +6 -8
- data/lib/kwartz/binding/eruby.rb +5 -120
- data/lib/kwartz/binding/jstl.rb +116 -101
- data/lib/kwartz/binding/php.rb +79 -60
- data/lib/kwartz/binding/pierubis.rb +58 -0
- data/lib/kwartz/binding/rails.rb +45 -42
- data/lib/kwartz/binding/ruby.rb +193 -0
- data/lib/kwartz/binding/struts.rb +1 -1
- data/lib/kwartz/config.rb +4 -3
- data/lib/kwartz/converter.rb +231 -68
- data/lib/kwartz/defun.rb +126 -0
- data/lib/kwartz/error.rb +1 -1
- data/lib/kwartz/helper/rails.rb +437 -0
- data/lib/kwartz/main.rb +30 -38
- data/lib/kwartz/node.rb +46 -31
- data/lib/kwartz/parser.rb +43 -15
- data/lib/kwartz/translator.rb +104 -6
- data/lib/kwartz/util.rb +113 -0
- data/lib/kwartz/util/assert-text-equal.rb +1 -1
- data/lib/kwartz/util/testcase-helper.rb +26 -8
- data/test/test-compile.rb +3 -3
- data/test/test-compile.yaml +135 -5
- data/test/test-converter.rb +16 -8
- data/test/test-converter.yaml +307 -76
- data/test/test-directives.rb +1 -1
- data/test/test-directives.yaml +964 -979
- data/test/test-main.rb +61 -146
- data/test/test-main.yaml +235 -0
- data/test/test-parser.rb +10 -12
- data/test/test-parser.yaml +484 -326
- data/test/test-rails.rb +1 -1
- data/test/test-rails.yaml +37 -37
- data/test/test-ruleset.rb +1 -1
- data/test/test-ruleset.yaml +34 -40
- data/test/test.rb +1 -1
- metadata +82 -3
- data/COPYING +0 -340
@@ -98,12 +98,17 @@ href="JstlTranslator.html">JstlTranslator</a>, and so on for detail.
|
|
98
98
|
<h3 class="section-bar">Methods</h3>
|
99
99
|
|
100
100
|
<div class="name-list">
|
101
|
-
<a href="#
|
102
|
-
<a href="#
|
103
|
-
<a href="#
|
104
|
-
<a href="#
|
105
|
-
<a href="#
|
106
|
-
<a href="#
|
101
|
+
<a href="#M000130">add_debug_expr</a>
|
102
|
+
<a href="#M000129">add_escaped_expr</a>
|
103
|
+
<a href="#M000128">add_plain_expr</a>
|
104
|
+
<a href="#M000121">new</a>
|
105
|
+
<a href="#M000131">optimize_print_stmts</a>
|
106
|
+
<a href="#M000127">parse_embedded_expr</a>
|
107
|
+
<a href="#M000122">translate</a>
|
108
|
+
<a href="#M000125">translate_native_expr</a>
|
109
|
+
<a href="#M000123">translate_native_stmt</a>
|
110
|
+
<a href="#M000124">translate_print_stmt</a>
|
111
|
+
<a href="#M000126">translate_string</a>
|
107
112
|
</div>
|
108
113
|
</div>
|
109
114
|
|
@@ -148,19 +153,19 @@ href="JstlTranslator.html">JstlTranslator</a>, and so on for detail.
|
|
148
153
|
<div id="methods">
|
149
154
|
<h3 class="section-bar">Public Class methods</h3>
|
150
155
|
|
151
|
-
<div id="method-
|
152
|
-
<a name="
|
156
|
+
<div id="method-M000121" class="method-detail">
|
157
|
+
<a name="M000121"></a>
|
153
158
|
|
154
159
|
<div class="method-heading">
|
155
|
-
<a href="#
|
160
|
+
<a href="#M000121" class="method-signature">
|
156
161
|
<span class="method-name">new</span><span class="method-args">(marks=[], properties={})</span>
|
157
162
|
</a>
|
158
163
|
</div>
|
159
164
|
|
160
165
|
<div class="method-description">
|
161
166
|
<p><a class="source-toggle" href="#"
|
162
|
-
onclick="toggleCode('
|
163
|
-
<div class="method-source-code" id="
|
167
|
+
onclick="toggleCode('M000121-source');return false;">[Source]</a></p>
|
168
|
+
<div class="method-source-code" id="M000121-source">
|
164
169
|
<pre>
|
165
170
|
<span class="ruby-comment cmt"># File kwartz/translator.rb, line 83</span>
|
166
171
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">marks</span>=[], <span class="ruby-identifier">properties</span>={})
|
@@ -178,22 +183,22 @@ href="JstlTranslator.html">JstlTranslator</a>, and so on for detail.
|
|
178
183
|
|
179
184
|
<h3 class="section-bar">Public Instance methods</h3>
|
180
185
|
|
181
|
-
<div id="method-
|
182
|
-
<a name="
|
186
|
+
<div id="method-M000122" class="method-detail">
|
187
|
+
<a name="M000122"></a>
|
183
188
|
|
184
189
|
<div class="method-heading">
|
185
|
-
<a href="#
|
186
|
-
<span class="method-name">translate</span><span class="method-args">(stmt_list
|
190
|
+
<a href="#M000122" class="method-signature">
|
191
|
+
<span class="method-name">translate</span><span class="method-args">(stmt_list)</span>
|
187
192
|
</a>
|
188
193
|
</div>
|
189
194
|
|
190
195
|
<div class="method-description">
|
191
196
|
<p><a class="source-toggle" href="#"
|
192
|
-
onclick="toggleCode('
|
193
|
-
<div class="method-source-code" id="
|
197
|
+
onclick="toggleCode('M000122-source');return false;">[Source]</a></p>
|
198
|
+
<div class="method-source-code" id="M000122-source">
|
194
199
|
<pre>
|
195
200
|
<span class="ruby-comment cmt"># File kwartz/translator.rb, line 96</span>
|
196
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">translate</span>(<span class="ruby-identifier">stmt_list</span
|
201
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">translate</span>(<span class="ruby-identifier">stmt_list</span>)
|
197
202
|
<span class="ruby-ivar">@sb</span> = <span class="ruby-value str">''</span>
|
198
203
|
<span class="ruby-ivar">@sb</span> <span class="ruby-operator"><<</span> <span class="ruby-ivar">@header</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@header</span>
|
199
204
|
<span class="ruby-identifier">stmt_list</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">stmt</span><span class="ruby-operator">|</span>
|
@@ -207,29 +212,29 @@ href="JstlTranslator.html">JstlTranslator</a>, and so on for detail.
|
|
207
212
|
</div>
|
208
213
|
</div>
|
209
214
|
|
210
|
-
<div id="method-
|
211
|
-
<a name="
|
215
|
+
<div id="method-M000125" class="method-detail">
|
216
|
+
<a name="M000125"></a>
|
212
217
|
|
213
218
|
<div class="method-heading">
|
214
|
-
<a href="#
|
219
|
+
<a href="#M000125" class="method-signature">
|
215
220
|
<span class="method-name">translate_native_expr</span><span class="method-args">(expr)</span>
|
216
221
|
</a>
|
217
222
|
</div>
|
218
223
|
|
219
224
|
<div class="method-description">
|
220
225
|
<p><a class="source-toggle" href="#"
|
221
|
-
onclick="toggleCode('
|
222
|
-
<div class="method-source-code" id="
|
226
|
+
onclick="toggleCode('M000125-source');return false;">[Source]</a></p>
|
227
|
+
<div class="method-source-code" id="M000125-source">
|
223
228
|
<pre>
|
224
|
-
<span class="ruby-comment cmt"># File kwartz/translator.rb, line
|
229
|
+
<span class="ruby-comment cmt"># File kwartz/translator.rb, line 128</span>
|
225
230
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">translate_native_expr</span>(<span class="ruby-identifier">expr</span>)
|
226
231
|
<span class="ruby-identifier">assert</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">expr</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">NativeExpression</span>)
|
227
232
|
<span class="ruby-identifier">flag_escape</span> = <span class="ruby-identifier">expr</span>.<span class="ruby-identifier">escape?</span>
|
228
233
|
<span class="ruby-identifier">flag_escape</span> = <span class="ruby-ivar">@escape</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">flag_escape</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span>
|
229
234
|
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">flag_escape</span>
|
230
|
-
<span class="ruby-
|
235
|
+
<span class="ruby-identifier">add_escaped_expr</span>(<span class="ruby-identifier">expr</span>.<span class="ruby-identifier">code</span>)
|
231
236
|
<span class="ruby-keyword kw">else</span>
|
232
|
-
<span class="ruby-
|
237
|
+
<span class="ruby-identifier">add_plain_expr</span>(<span class="ruby-identifier">expr</span>.<span class="ruby-identifier">code</span>)
|
233
238
|
<span class="ruby-keyword kw">end</span>
|
234
239
|
<span class="ruby-keyword kw">end</span>
|
235
240
|
</pre>
|
@@ -237,19 +242,19 @@ href="JstlTranslator.html">JstlTranslator</a>, and so on for detail.
|
|
237
242
|
</div>
|
238
243
|
</div>
|
239
244
|
|
240
|
-
<div id="method-
|
241
|
-
<a name="
|
245
|
+
<div id="method-M000123" class="method-detail">
|
246
|
+
<a name="M000123"></a>
|
242
247
|
|
243
248
|
<div class="method-heading">
|
244
|
-
<a href="#
|
249
|
+
<a href="#M000123" class="method-signature">
|
245
250
|
<span class="method-name">translate_native_stmt</span><span class="method-args">(stmt)</span>
|
246
251
|
</a>
|
247
252
|
</div>
|
248
253
|
|
249
254
|
<div class="method-description">
|
250
255
|
<p><a class="source-toggle" href="#"
|
251
|
-
onclick="toggleCode('
|
252
|
-
<div class="method-source-code" id="
|
256
|
+
onclick="toggleCode('M000123-source');return false;">[Source]</a></p>
|
257
|
+
<div class="method-source-code" id="M000123-source">
|
253
258
|
<pre>
|
254
259
|
<span class="ruby-comment cmt"># File kwartz/translator.rb, line 107</span>
|
255
260
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">translate_native_stmt</span>(<span class="ruby-identifier">stmt</span>)
|
@@ -261,26 +266,27 @@ href="JstlTranslator.html">JstlTranslator</a>, and so on for detail.
|
|
261
266
|
</div>
|
262
267
|
</div>
|
263
268
|
|
264
|
-
<div id="method-
|
265
|
-
<a name="
|
269
|
+
<div id="method-M000124" class="method-detail">
|
270
|
+
<a name="M000124"></a>
|
266
271
|
|
267
272
|
<div class="method-heading">
|
268
|
-
<a href="#
|
273
|
+
<a href="#M000124" class="method-signature">
|
269
274
|
<span class="method-name">translate_print_stmt</span><span class="method-args">(stmt)</span>
|
270
275
|
</a>
|
271
276
|
</div>
|
272
277
|
|
273
278
|
<div class="method-description">
|
274
279
|
<p><a class="source-toggle" href="#"
|
275
|
-
onclick="toggleCode('
|
276
|
-
<div class="method-source-code" id="
|
280
|
+
onclick="toggleCode('M000124-source');return false;">[Source]</a></p>
|
281
|
+
<div class="method-source-code" id="M000124-source">
|
277
282
|
<pre>
|
278
283
|
<span class="ruby-comment cmt"># File kwartz/translator.rb, line 113</span>
|
279
284
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">translate_print_stmt</span>(<span class="ruby-identifier">stmt</span>)
|
280
285
|
<span class="ruby-identifier">stmt</span>.<span class="ruby-identifier">args</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">arg</span><span class="ruby-operator">|</span>
|
281
286
|
<span class="ruby-comment cmt">#arg.accept(self)</span>
|
282
287
|
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">arg</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
|
283
|
-
<span class="ruby-
|
288
|
+
<span class="ruby-comment cmt">#translate_string(arg)</span>
|
289
|
+
<span class="ruby-identifier">parse_embedded_expr</span>(<span class="ruby-identifier">arg</span>)
|
284
290
|
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">arg</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">NativeExpression</span>)
|
285
291
|
<span class="ruby-identifier">translate_native_expr</span>(<span class="ruby-identifier">arg</span>)
|
286
292
|
<span class="ruby-keyword kw">else</span>
|
@@ -293,21 +299,21 @@ href="JstlTranslator.html">JstlTranslator</a>, and so on for detail.
|
|
293
299
|
</div>
|
294
300
|
</div>
|
295
301
|
|
296
|
-
<div id="method-
|
297
|
-
<a name="
|
302
|
+
<div id="method-M000126" class="method-detail">
|
303
|
+
<a name="M000126"></a>
|
298
304
|
|
299
305
|
<div class="method-heading">
|
300
|
-
<a href="#
|
306
|
+
<a href="#M000126" class="method-signature">
|
301
307
|
<span class="method-name">translate_string</span><span class="method-args">(str)</span>
|
302
308
|
</a>
|
303
309
|
</div>
|
304
310
|
|
305
311
|
<div class="method-description">
|
306
312
|
<p><a class="source-toggle" href="#"
|
307
|
-
onclick="toggleCode('
|
308
|
-
<div class="method-source-code" id="
|
313
|
+
onclick="toggleCode('M000126-source');return false;">[Source]</a></p>
|
314
|
+
<div class="method-source-code" id="M000126-source">
|
309
315
|
<pre>
|
310
|
-
<span class="ruby-comment cmt"># File kwartz/translator.rb, line
|
316
|
+
<span class="ruby-comment cmt"># File kwartz/translator.rb, line 140</span>
|
311
317
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">translate_string</span>(<span class="ruby-identifier">str</span>)
|
312
318
|
<span class="ruby-ivar">@sb</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">str</span>
|
313
319
|
<span class="ruby-keyword kw">end</span>
|
@@ -316,6 +322,167 @@ href="JstlTranslator.html">JstlTranslator</a>, and so on for detail.
|
|
316
322
|
</div>
|
317
323
|
</div>
|
318
324
|
|
325
|
+
<h3 class="section-bar">Protected Instance methods</h3>
|
326
|
+
|
327
|
+
<div id="method-M000130" class="method-detail">
|
328
|
+
<a name="M000130"></a>
|
329
|
+
|
330
|
+
<div class="method-heading">
|
331
|
+
<a href="#M000130" class="method-signature">
|
332
|
+
<span class="method-name">add_debug_expr</span><span class="method-args">(expr_code)</span>
|
333
|
+
</a>
|
334
|
+
</div>
|
335
|
+
|
336
|
+
<div class="method-description">
|
337
|
+
<p><a class="source-toggle" href="#"
|
338
|
+
onclick="toggleCode('M000130-source');return false;">[Source]</a></p>
|
339
|
+
<div class="method-source-code" id="M000130-source">
|
340
|
+
<pre>
|
341
|
+
<span class="ruby-comment cmt"># File kwartz/translator.rb, line 182</span>
|
342
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_debug_expr</span>(<span class="ruby-identifier">expr_code</span>)
|
343
|
+
<span class="ruby-identifier">not_implemented</span>
|
344
|
+
<span class="ruby-keyword kw">end</span>
|
345
|
+
</pre>
|
346
|
+
</div>
|
347
|
+
</div>
|
348
|
+
</div>
|
349
|
+
|
350
|
+
<div id="method-M000129" class="method-detail">
|
351
|
+
<a name="M000129"></a>
|
352
|
+
|
353
|
+
<div class="method-heading">
|
354
|
+
<a href="#M000129" class="method-signature">
|
355
|
+
<span class="method-name">add_escaped_expr</span><span class="method-args">(expr_code)</span>
|
356
|
+
</a>
|
357
|
+
</div>
|
358
|
+
|
359
|
+
<div class="method-description">
|
360
|
+
<p><a class="source-toggle" href="#"
|
361
|
+
onclick="toggleCode('M000129-source');return false;">[Source]</a></p>
|
362
|
+
<div class="method-source-code" id="M000129-source">
|
363
|
+
<pre>
|
364
|
+
<span class="ruby-comment cmt"># File kwartz/translator.rb, line 177</span>
|
365
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_escaped_expr</span>(<span class="ruby-identifier">expr_code</span>)
|
366
|
+
<span class="ruby-ivar">@sb</span> <span class="ruby-operator"><<</span> <span class="ruby-ivar">@escape_l</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">expr_code</span> <span class="ruby-operator"><<</span> <span class="ruby-ivar">@escape_r</span> <span class="ruby-comment cmt"># ex. <%=h expr_code %></span>
|
367
|
+
<span class="ruby-keyword kw">end</span>
|
368
|
+
</pre>
|
369
|
+
</div>
|
370
|
+
</div>
|
371
|
+
</div>
|
372
|
+
|
373
|
+
<div id="method-M000128" class="method-detail">
|
374
|
+
<a name="M000128"></a>
|
375
|
+
|
376
|
+
<div class="method-heading">
|
377
|
+
<a href="#M000128" class="method-signature">
|
378
|
+
<span class="method-name">add_plain_expr</span><span class="method-args">(expr_code)</span>
|
379
|
+
</a>
|
380
|
+
</div>
|
381
|
+
|
382
|
+
<div class="method-description">
|
383
|
+
<p><a class="source-toggle" href="#"
|
384
|
+
onclick="toggleCode('M000128-source');return false;">[Source]</a></p>
|
385
|
+
<div class="method-source-code" id="M000128-source">
|
386
|
+
<pre>
|
387
|
+
<span class="ruby-comment cmt"># File kwartz/translator.rb, line 172</span>
|
388
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_plain_expr</span>(<span class="ruby-identifier">expr_code</span>)
|
389
|
+
<span class="ruby-ivar">@sb</span> <span class="ruby-operator"><<</span> <span class="ruby-ivar">@expr_l</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">expr_code</span> <span class="ruby-operator"><<</span> <span class="ruby-ivar">@expr_r</span> <span class="ruby-comment cmt"># ex. <%= expr_code %></span>
|
390
|
+
<span class="ruby-keyword kw">end</span>
|
391
|
+
</pre>
|
392
|
+
</div>
|
393
|
+
</div>
|
394
|
+
</div>
|
395
|
+
|
396
|
+
<div id="method-M000131" class="method-detail">
|
397
|
+
<a name="M000131"></a>
|
398
|
+
|
399
|
+
<div class="method-heading">
|
400
|
+
<a href="#M000131" class="method-signature">
|
401
|
+
<span class="method-name">optimize_print_stmts</span><span class="method-args">(stmt_list)</span>
|
402
|
+
</a>
|
403
|
+
</div>
|
404
|
+
|
405
|
+
<div class="method-description">
|
406
|
+
<p>
|
407
|
+
concat several print statements into a statement
|
408
|
+
</p>
|
409
|
+
<p><a class="source-toggle" href="#"
|
410
|
+
onclick="toggleCode('M000131-source');return false;">[Source]</a></p>
|
411
|
+
<div class="method-source-code" id="M000131-source">
|
412
|
+
<pre>
|
413
|
+
<span class="ruby-comment cmt"># File kwartz/translator.rb, line 188</span>
|
414
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">optimize_print_stmts</span>(<span class="ruby-identifier">stmt_list</span>)
|
415
|
+
<span class="ruby-identifier">stmt_list2</span> = []
|
416
|
+
<span class="ruby-identifier">args</span> = []
|
417
|
+
<span class="ruby-identifier">stmt_list</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">stmt</span><span class="ruby-operator">|</span>
|
418
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">stmt</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">PrintStatement</span>)
|
419
|
+
<span class="ruby-identifier">args</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">stmt</span>.<span class="ruby-identifier">args</span>
|
420
|
+
<span class="ruby-keyword kw">else</span>
|
421
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">args</span>.<span class="ruby-identifier">empty?</span>
|
422
|
+
<span class="ruby-identifier">args</span> = <span class="ruby-identifier">_compact_args</span>(<span class="ruby-identifier">args</span>)
|
423
|
+
<span class="ruby-identifier">stmt_list2</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">PrintStatement</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">args</span>)
|
424
|
+
<span class="ruby-identifier">args</span> = []
|
425
|
+
<span class="ruby-keyword kw">end</span>
|
426
|
+
<span class="ruby-identifier">stmt_list2</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">stmt</span>
|
427
|
+
<span class="ruby-keyword kw">end</span>
|
428
|
+
<span class="ruby-keyword kw">end</span>
|
429
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">args</span>.<span class="ruby-identifier">empty?</span>
|
430
|
+
<span class="ruby-identifier">args</span> = <span class="ruby-identifier">_compact_args</span>(<span class="ruby-identifier">args</span>)
|
431
|
+
<span class="ruby-identifier">stmt_list2</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">PrintStatement</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">args</span>)
|
432
|
+
<span class="ruby-keyword kw">end</span>
|
433
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">stmt_list2</span>
|
434
|
+
<span class="ruby-keyword kw">end</span>
|
435
|
+
</pre>
|
436
|
+
</div>
|
437
|
+
</div>
|
438
|
+
</div>
|
439
|
+
|
440
|
+
<div id="method-M000127" class="method-detail">
|
441
|
+
<a name="M000127"></a>
|
442
|
+
|
443
|
+
<div class="method-heading">
|
444
|
+
<a href="#M000127" class="method-signature">
|
445
|
+
<span class="method-name">parse_embedded_expr</span><span class="method-args">(text)</span>
|
446
|
+
</a>
|
447
|
+
</div>
|
448
|
+
|
449
|
+
<div class="method-description">
|
450
|
+
<p>
|
451
|
+
def translate_text_expr(expr)
|
452
|
+
</p>
|
453
|
+
<pre>
|
454
|
+
@sb << expr.text
|
455
|
+
</pre>
|
456
|
+
<p>
|
457
|
+
end
|
458
|
+
</p>
|
459
|
+
<p><a class="source-toggle" href="#"
|
460
|
+
onclick="toggleCode('M000127-source');return false;">[Source]</a></p>
|
461
|
+
<div class="method-source-code" id="M000127-source">
|
462
|
+
<pre>
|
463
|
+
<span class="ruby-comment cmt"># File kwartz/translator.rb, line 153</span>
|
464
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse_embedded_expr</span>(<span class="ruby-identifier">text</span>)
|
465
|
+
<span class="ruby-identifier">pos</span> = <span class="ruby-value">0</span>
|
466
|
+
<span class="ruby-identifier">text</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/@(!*)\{(.*?)\}@/</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">indicator</span>, <span class="ruby-identifier">expr_code</span><span class="ruby-operator">|</span>
|
467
|
+
<span class="ruby-identifier">m</span> = <span class="ruby-constant">Regexp</span>.<span class="ruby-identifier">last_match</span>
|
468
|
+
<span class="ruby-identifier">s</span> = <span class="ruby-identifier">text</span>[<span class="ruby-identifier">pos</span>, <span class="ruby-identifier">m</span>.<span class="ruby-identifier">begin</span>(<span class="ruby-value">0</span>) <span class="ruby-operator">-</span> <span class="ruby-identifier">pos</span>]
|
469
|
+
<span class="ruby-identifier">pos</span> = <span class="ruby-identifier">m</span>.<span class="ruby-identifier">end</span>(<span class="ruby-value">0</span>)
|
470
|
+
<span class="ruby-identifier">translate_string</span>(<span class="ruby-identifier">s</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">s</span>.<span class="ruby-identifier">empty?</span>
|
471
|
+
<span class="ruby-keyword kw">case</span> <span class="ruby-identifier">indicator</span>
|
472
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-keyword kw">nil</span>, <span class="ruby-value str">''</span> ; <span class="ruby-identifier">add_escaped_expr</span>(<span class="ruby-identifier">expr_code</span>)
|
473
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">'!'</span> ; <span class="ruby-identifier">add_plain_expr</span>(<span class="ruby-identifier">expr_code</span>)
|
474
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">'!!'</span> ; <span class="ruby-identifier">add_debug_expr</span>(<span class="ruby-identifier">expr_code</span>)
|
475
|
+
<span class="ruby-keyword kw">else</span> ; <span class="ruby-comment cmt"># do nothing</span>
|
476
|
+
<span class="ruby-keyword kw">end</span>
|
477
|
+
<span class="ruby-keyword kw">end</span>
|
478
|
+
<span class="ruby-identifier">rest</span> = <span class="ruby-identifier">pos</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">text</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">$'</span>
|
479
|
+
<span class="ruby-identifier">translate_string</span>(<span class="ruby-identifier">rest</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">rest</span>.<span class="ruby-identifier">empty?</span>
|
480
|
+
<span class="ruby-keyword kw">end</span>
|
481
|
+
</pre>
|
482
|
+
</div>
|
483
|
+
</div>
|
484
|
+
</div>
|
485
|
+
|
319
486
|
|
320
487
|
</div>
|
321
488
|
|
@@ -80,10 +80,10 @@
|
|
80
80
|
<h3 class="section-bar">Methods</h3>
|
81
81
|
|
82
82
|
<div class="name-list">
|
83
|
-
<a href="#
|
84
|
-
<a href="#
|
85
|
-
<a href="#
|
86
|
-
<a href="#
|
83
|
+
<a href="#M000019">is_alpha</a>
|
84
|
+
<a href="#M000020">is_digit</a>
|
85
|
+
<a href="#M000021">is_identchar</a>
|
86
|
+
<a href="#M000018">is_whitespace</a>
|
87
87
|
</div>
|
88
88
|
</div>
|
89
89
|
|
@@ -105,19 +105,19 @@
|
|
105
105
|
<div id="methods">
|
106
106
|
<h3 class="section-bar">Public Instance methods</h3>
|
107
107
|
|
108
|
-
<div id="method-
|
109
|
-
<a name="
|
108
|
+
<div id="method-M000019" class="method-detail">
|
109
|
+
<a name="M000019"></a>
|
110
110
|
|
111
111
|
<div class="method-heading">
|
112
|
-
<a href="#
|
112
|
+
<a href="#M000019" class="method-signature">
|
113
113
|
<span class="method-name">is_alpha</span><span class="method-args">(ch)</span>
|
114
114
|
</a>
|
115
115
|
</div>
|
116
116
|
|
117
117
|
<div class="method-description">
|
118
118
|
<p><a class="source-toggle" href="#"
|
119
|
-
onclick="toggleCode('
|
120
|
-
<div class="method-source-code" id="
|
119
|
+
onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
|
120
|
+
<div class="method-source-code" id="M000019-source">
|
121
121
|
<pre>
|
122
122
|
<span class="ruby-comment cmt"># File kwartz/parser.rb, line 26</span>
|
123
123
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">is_alpha</span>(<span class="ruby-identifier">ch</span>)
|
@@ -128,19 +128,19 @@
|
|
128
128
|
</div>
|
129
129
|
</div>
|
130
130
|
|
131
|
-
<div id="method-
|
132
|
-
<a name="
|
131
|
+
<div id="method-M000020" class="method-detail">
|
132
|
+
<a name="M000020"></a>
|
133
133
|
|
134
134
|
<div class="method-heading">
|
135
|
-
<a href="#
|
135
|
+
<a href="#M000020" class="method-signature">
|
136
136
|
<span class="method-name">is_digit</span><span class="method-args">(ch)</span>
|
137
137
|
</a>
|
138
138
|
</div>
|
139
139
|
|
140
140
|
<div class="method-description">
|
141
141
|
<p><a class="source-toggle" href="#"
|
142
|
-
onclick="toggleCode('
|
143
|
-
<div class="method-source-code" id="
|
142
|
+
onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
|
143
|
+
<div class="method-source-code" id="M000020-source">
|
144
144
|
<pre>
|
145
145
|
<span class="ruby-comment cmt"># File kwartz/parser.rb, line 31</span>
|
146
146
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">is_digit</span>(<span class="ruby-identifier">ch</span>)
|
@@ -151,19 +151,19 @@
|
|
151
151
|
</div>
|
152
152
|
</div>
|
153
153
|
|
154
|
-
<div id="method-
|
155
|
-
<a name="
|
154
|
+
<div id="method-M000021" class="method-detail">
|
155
|
+
<a name="M000021"></a>
|
156
156
|
|
157
157
|
<div class="method-heading">
|
158
|
-
<a href="#
|
158
|
+
<a href="#M000021" class="method-signature">
|
159
159
|
<span class="method-name">is_identchar</span><span class="method-args">(ch)</span>
|
160
160
|
</a>
|
161
161
|
</div>
|
162
162
|
|
163
163
|
<div class="method-description">
|
164
164
|
<p><a class="source-toggle" href="#"
|
165
|
-
onclick="toggleCode('
|
166
|
-
<div class="method-source-code" id="
|
165
|
+
onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
|
166
|
+
<div class="method-source-code" id="M000021-source">
|
167
167
|
<pre>
|
168
168
|
<span class="ruby-comment cmt"># File kwartz/parser.rb, line 36</span>
|
169
169
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">is_identchar</span>(<span class="ruby-identifier">ch</span>)
|
@@ -174,19 +174,19 @@
|
|
174
174
|
</div>
|
175
175
|
</div>
|
176
176
|
|
177
|
-
<div id="method-
|
178
|
-
<a name="
|
177
|
+
<div id="method-M000018" class="method-detail">
|
178
|
+
<a name="M000018"></a>
|
179
179
|
|
180
180
|
<div class="method-heading">
|
181
|
-
<a href="#
|
181
|
+
<a href="#M000018" class="method-signature">
|
182
182
|
<span class="method-name">is_whitespace</span><span class="method-args">(ch)</span>
|
183
183
|
</a>
|
184
184
|
</div>
|
185
185
|
|
186
186
|
<div class="method-description">
|
187
187
|
<p><a class="source-toggle" href="#"
|
188
|
-
onclick="toggleCode('
|
189
|
-
<div class="method-source-code" id="
|
188
|
+
onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
|
189
|
+
<div class="method-source-code" id="M000018-source">
|
190
190
|
<pre>
|
191
191
|
<span class="ruby-comment cmt"># File kwartz/parser.rb, line 21</span>
|
192
192
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">is_whitespace</span>(<span class="ruby-identifier">ch</span>)
|