kwartz 3.0.0 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (179) hide show
  1. data/ChangeLog +36 -1
  2. data/LGPL +504 -0
  3. data/README.txt +16 -2
  4. data/bin/kwartz +1 -1
  5. data/doc-api/classes/Kwartz.html +47 -1
  6. data/doc-api/classes/Kwartz/Assertion.html +6 -6
  7. data/doc-api/classes/Kwartz/AssertionError.html +6 -6
  8. data/doc-api/classes/Kwartz/AttrInfo.html +42 -42
  9. data/doc-api/classes/Kwartz/BaseError.html +12 -12
  10. data/doc-api/classes/Kwartz/BaseTranslator.html +210 -43
  11. data/doc-api/classes/Kwartz/CharacterType.html +24 -24
  12. data/doc-api/classes/Kwartz/CommandOptionError.html +7 -7
  13. data/doc-api/classes/Kwartz/CommandOptions.html +49 -49
  14. data/doc-api/classes/Kwartz/Config.html +6 -1
  15. data/doc-api/classes/Kwartz/ConvertError.html +14 -14
  16. data/doc-api/classes/Kwartz/Converter.html +31 -30
  17. data/doc-api/classes/Kwartz/CssStyleParser.html +79 -57
  18. data/doc-api/classes/Kwartz/Defun.html +313 -0
  19. data/doc-api/classes/Kwartz/DocumentRuleset.html +58 -58
  20. data/doc-api/classes/Kwartz/ElementExpander.html +32 -32
  21. data/doc-api/classes/Kwartz/ElementInfo.html +29 -29
  22. data/doc-api/classes/Kwartz/ElementRuleset.html +126 -96
  23. data/doc-api/classes/Kwartz/EperlHandler.html +108 -84
  24. data/doc-api/classes/Kwartz/EperlTranslator.html +7 -7
  25. data/doc-api/classes/Kwartz/ErubisHandler.html +2 -2
  26. data/doc-api/classes/Kwartz/ErubisTranslator.html +8 -8
  27. data/doc-api/classes/Kwartz/ErubyHandler.html +2 -220
  28. data/doc-api/classes/Kwartz/ErubyTranslator.html +7 -7
  29. data/doc-api/classes/Kwartz/ExpandStatement.html +20 -20
  30. data/doc-api/classes/Kwartz/Handler.html +122 -117
  31. data/doc-api/classes/Kwartz/HandlerArgument.html +215 -0
  32. data/doc-api/classes/Kwartz/Helper.html +112 -0
  33. data/doc-api/classes/Kwartz/Helper/ActionViewHelper.html +221 -0
  34. data/doc-api/classes/Kwartz/Helper/RailsTemplate.html +630 -0
  35. data/doc-api/classes/Kwartz/JstlHandler.html +208 -193
  36. data/doc-api/classes/Kwartz/JstlTranslator.html +15 -15
  37. data/doc-api/classes/Kwartz/KwartzError.html +6 -6
  38. data/doc-api/classes/Kwartz/Main.html +39 -23
  39. data/doc-api/classes/Kwartz/NativeExpression.html +18 -18
  40. data/doc-api/classes/Kwartz/NativeStatement.html +25 -25
  41. data/doc-api/classes/Kwartz/Node.html +6 -6
  42. data/doc-api/classes/Kwartz/PIErubisHandler.html +113 -0
  43. data/doc-api/classes/Kwartz/PIErubisTranslator.html +200 -0
  44. data/doc-api/classes/Kwartz/ParseError.html +6 -6
  45. data/doc-api/classes/Kwartz/PhpHandler.html +102 -83
  46. data/doc-api/classes/Kwartz/PhpTranslator.html +14 -14
  47. data/doc-api/classes/Kwartz/PresentationLogicParser.html +136 -128
  48. data/doc-api/classes/Kwartz/PrintStatement.html +19 -19
  49. data/doc-api/classes/Kwartz/RailsHandler.html +121 -118
  50. data/doc-api/classes/Kwartz/RailsTranslator.html +7 -7
  51. data/doc-api/classes/Kwartz/RubyHandler.html +349 -0
  52. data/doc-api/classes/Kwartz/RubyStyleParser.html +85 -85
  53. data/doc-api/classes/Kwartz/RubyTranslator.html +218 -0
  54. data/doc-api/classes/Kwartz/StatementHelper.html +479 -0
  55. data/doc-api/classes/Kwartz/StrutsTranslator.html +12 -12
  56. data/doc-api/classes/Kwartz/TagInfo.html +28 -28
  57. data/doc-api/classes/Kwartz/TextConverter.html +28 -28
  58. data/doc-api/classes/Kwartz/Translator.html +42 -42
  59. data/doc-api/classes/Kwartz/Util.html +284 -0
  60. data/doc-api/created.rid +1 -1
  61. data/doc-api/files/__/README_txt.html +30 -3
  62. data/doc-api/files/kwartz/assert_rb.html +1 -1
  63. data/doc-api/files/kwartz/binding/eperl_rb.html +2 -2
  64. data/doc-api/files/kwartz/binding/erubis_rb.html +3 -3
  65. data/doc-api/files/kwartz/binding/eruby_rb.html +3 -2
  66. data/doc-api/files/kwartz/binding/jstl_rb.html +2 -2
  67. data/doc-api/files/kwartz/binding/php_rb.html +2 -2
  68. data/doc-api/files/kwartz/binding/pierubis_rb.html +116 -0
  69. data/doc-api/files/kwartz/binding/rails_rb.html +2 -2
  70. data/doc-api/files/kwartz/binding/ruby_rb.html +115 -0
  71. data/doc-api/files/kwartz/binding/struts_rb.html +1 -1
  72. data/doc-api/files/kwartz/config_rb.html +2 -2
  73. data/doc-api/files/kwartz/converter_rb.html +3 -2
  74. data/doc-api/files/kwartz/defun_rb.html +116 -0
  75. data/doc-api/files/kwartz/error_rb.html +1 -1
  76. data/doc-api/files/kwartz/helper/rails_rb.html +123 -0
  77. data/doc-api/files/kwartz/main_rb.html +5 -2
  78. data/doc-api/files/kwartz/node_rb.html +2 -2
  79. data/doc-api/files/kwartz/parser_rb.html +2 -2
  80. data/doc-api/files/kwartz/translator_rb.html +2 -2
  81. data/doc-api/files/kwartz/util/assert-text-equal_rb.html +1 -1
  82. data/doc-api/files/kwartz/util/testcase-helper_rb.html +2 -2
  83. data/doc-api/files/kwartz/util_rb.html +107 -0
  84. data/doc-api/files/kwartz_rb.html +3 -2
  85. data/doc-api/fr_class_index.html +11 -0
  86. data/doc-api/fr_file_index.html +5 -0
  87. data/doc-api/fr_method_index.html +242 -190
  88. data/doc/p-pattern.html +94 -94
  89. data/doc/reference.html +847 -612
  90. data/doc/users-guide.html +744 -241
  91. data/examples/rails1/README +2 -2
  92. data/examples/rails1/application_helper.rb +2 -27
  93. data/examples/rails1/link_to.plogic +5 -5
  94. data/examples/rails1/list.plogic +2 -2
  95. data/examples/rails2/app/controllers/application.rb +14 -0
  96. data/examples/rails2/app/controllers/groups_controller.rb +47 -0
  97. data/examples/rails2/app/controllers/members_controller.rb +56 -0
  98. data/examples/rails2/app/helpers/application_helper.rb +6 -0
  99. data/examples/rails2/app/helpers/groups_helper.rb +2 -0
  100. data/examples/rails2/app/helpers/members_helper.rb +2 -0
  101. data/examples/rails2/app/models/group.rb +2 -0
  102. data/examples/rails2/app/models/member.rb +3 -0
  103. data/examples/rails2/app/views/groups/_form.html +30 -0
  104. data/examples/rails2/app/views/groups/_form.plogic +11 -0
  105. data/examples/rails2/app/views/groups/_link.plogic +19 -0
  106. data/examples/rails2/app/views/groups/_read.plogic +7 -0
  107. data/examples/rails2/app/views/groups/edit.cfg.yaml +2 -0
  108. data/examples/rails2/app/views/groups/edit.html +26 -0
  109. data/examples/rails2/app/views/groups/edit.plogic +9 -0
  110. data/examples/rails2/app/views/groups/list.html +48 -0
  111. data/examples/rails2/app/views/groups/list.plogic +32 -0
  112. data/examples/rails2/app/views/groups/new.cfg.yaml +2 -0
  113. data/examples/rails2/app/views/groups/new.html +27 -0
  114. data/examples/rails2/app/views/groups/new.plogic +9 -0
  115. data/examples/rails2/app/views/groups/show.html +27 -0
  116. data/examples/rails2/app/views/groups/show.plogic +2 -0
  117. data/examples/rails2/app/views/layouts/groups.html +23 -0
  118. data/examples/rails2/app/views/layouts/groups.plogic +11 -0
  119. data/examples/rails2/app/views/layouts/members.html +23 -0
  120. data/examples/rails2/app/views/layouts/members.plogic +11 -0
  121. data/examples/rails2/app/views/layouts/members2.html +24 -0
  122. data/examples/rails2/app/views/layouts/members2.plogic +11 -0
  123. data/examples/rails2/app/views/members/_form.plogic +27 -0
  124. data/examples/rails2/app/views/members/_link.plogic +19 -0
  125. data/examples/rails2/app/views/members/_read.plogic +29 -0
  126. data/examples/rails2/app/views/members/edit.cfg.yaml +6 -0
  127. data/examples/rails2/app/views/members/edit.html +27 -0
  128. data/examples/rails2/app/views/members/edit.plogic +10 -0
  129. data/examples/rails2/app/views/members/list.html +53 -0
  130. data/examples/rails2/app/views/members/list.plogic +32 -0
  131. data/examples/rails2/app/views/members/new.html +61 -0
  132. data/examples/rails2/app/views/members/new.plogic +17 -0
  133. data/examples/rails2/app/views/members/show.html +41 -0
  134. data/examples/rails2/app/views/members/show.plogic +3 -0
  135. data/examples/rails2/db/create-tables.mysql.sql +27 -0
  136. data/examples/rails2/db/create-tables.pgsql.sql +27 -0
  137. data/examples/rails2/db/insert-data.sql +21 -0
  138. data/examples/rails2/db/tabledef.yaml +51 -0
  139. data/kwartz.gemspec +4 -4
  140. data/lib/kwartz.rb +10 -2
  141. data/lib/kwartz/assert.rb +1 -1
  142. data/lib/kwartz/binding/eperl.rb +85 -61
  143. data/lib/kwartz/binding/erubis.rb +6 -8
  144. data/lib/kwartz/binding/eruby.rb +5 -120
  145. data/lib/kwartz/binding/jstl.rb +116 -101
  146. data/lib/kwartz/binding/php.rb +79 -60
  147. data/lib/kwartz/binding/pierubis.rb +58 -0
  148. data/lib/kwartz/binding/rails.rb +45 -42
  149. data/lib/kwartz/binding/ruby.rb +193 -0
  150. data/lib/kwartz/binding/struts.rb +1 -1
  151. data/lib/kwartz/config.rb +4 -3
  152. data/lib/kwartz/converter.rb +231 -68
  153. data/lib/kwartz/defun.rb +126 -0
  154. data/lib/kwartz/error.rb +1 -1
  155. data/lib/kwartz/helper/rails.rb +437 -0
  156. data/lib/kwartz/main.rb +30 -38
  157. data/lib/kwartz/node.rb +46 -31
  158. data/lib/kwartz/parser.rb +43 -15
  159. data/lib/kwartz/translator.rb +104 -6
  160. data/lib/kwartz/util.rb +113 -0
  161. data/lib/kwartz/util/assert-text-equal.rb +1 -1
  162. data/lib/kwartz/util/testcase-helper.rb +26 -8
  163. data/test/test-compile.rb +3 -3
  164. data/test/test-compile.yaml +135 -5
  165. data/test/test-converter.rb +16 -8
  166. data/test/test-converter.yaml +307 -76
  167. data/test/test-directives.rb +1 -1
  168. data/test/test-directives.yaml +964 -979
  169. data/test/test-main.rb +61 -146
  170. data/test/test-main.yaml +235 -0
  171. data/test/test-parser.rb +10 -12
  172. data/test/test-parser.yaml +484 -326
  173. data/test/test-rails.rb +1 -1
  174. data/test/test-rails.yaml +37 -37
  175. data/test/test-ruleset.rb +1 -1
  176. data/test/test-ruleset.yaml +34 -40
  177. data/test/test.rb +1 -1
  178. metadata +82 -3
  179. 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="#M000084">new</a>&nbsp;&nbsp;
102
- <a href="#M000085">translate</a>&nbsp;&nbsp;
103
- <a href="#M000088">translate_native_expr</a>&nbsp;&nbsp;
104
- <a href="#M000086">translate_native_stmt</a>&nbsp;&nbsp;
105
- <a href="#M000087">translate_print_stmt</a>&nbsp;&nbsp;
106
- <a href="#M000089">translate_string</a>&nbsp;&nbsp;
101
+ <a href="#M000130">add_debug_expr</a>&nbsp;&nbsp;
102
+ <a href="#M000129">add_escaped_expr</a>&nbsp;&nbsp;
103
+ <a href="#M000128">add_plain_expr</a>&nbsp;&nbsp;
104
+ <a href="#M000121">new</a>&nbsp;&nbsp;
105
+ <a href="#M000131">optimize_print_stmts</a>&nbsp;&nbsp;
106
+ <a href="#M000127">parse_embedded_expr</a>&nbsp;&nbsp;
107
+ <a href="#M000122">translate</a>&nbsp;&nbsp;
108
+ <a href="#M000125">translate_native_expr</a>&nbsp;&nbsp;
109
+ <a href="#M000123">translate_native_stmt</a>&nbsp;&nbsp;
110
+ <a href="#M000124">translate_print_stmt</a>&nbsp;&nbsp;
111
+ <a href="#M000126">translate_string</a>&nbsp;&nbsp;
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-M000084" class="method-detail">
152
- <a name="M000084"></a>
156
+ <div id="method-M000121" class="method-detail">
157
+ <a name="M000121"></a>
153
158
 
154
159
  <div class="method-heading">
155
- <a href="#M000084" class="method-signature">
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('M000084-source');return false;">[Source]</a></p>
163
- <div class="method-source-code" id="M000084-source">
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-M000085" class="method-detail">
182
- <a name="M000085"></a>
186
+ <div id="method-M000122" class="method-detail">
187
+ <a name="M000122"></a>
183
188
 
184
189
  <div class="method-heading">
185
- <a href="#M000085" class="method-signature">
186
- <span class="method-name">translate</span><span class="method-args">(stmt_list=[])</span>
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('M000085-source');return false;">[Source]</a></p>
193
- <div class="method-source-code" id="M000085-source">
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">&lt;&lt;</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-M000088" class="method-detail">
211
- <a name="M000088"></a>
215
+ <div id="method-M000125" class="method-detail">
216
+ <a name="M000125"></a>
212
217
 
213
218
  <div class="method-heading">
214
- <a href="#M000088" class="method-signature">
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('M000088-source');return false;">[Source]</a></p>
222
- <div class="method-source-code" id="M000088-source">
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 127</span>
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-ivar">@sb</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@escape_l</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">expr</span>.<span class="ruby-identifier">code</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@escape_r</span> <span class="ruby-comment cmt"># ex. &lt;%=h expr.code %&gt;</span>
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-ivar">@sb</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@expr_l</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">expr</span>.<span class="ruby-identifier">code</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@expr_r</span> <span class="ruby-comment cmt"># ex. &lt;%= expr.code %&gt;</span>
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-M000086" class="method-detail">
241
- <a name="M000086"></a>
245
+ <div id="method-M000123" class="method-detail">
246
+ <a name="M000123"></a>
242
247
 
243
248
  <div class="method-heading">
244
- <a href="#M000086" class="method-signature">
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('M000086-source');return false;">[Source]</a></p>
252
- <div class="method-source-code" id="M000086-source">
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-M000087" class="method-detail">
265
- <a name="M000087"></a>
269
+ <div id="method-M000124" class="method-detail">
270
+ <a name="M000124"></a>
266
271
 
267
272
  <div class="method-heading">
268
- <a href="#M000087" class="method-signature">
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('M000087-source');return false;">[Source]</a></p>
276
- <div class="method-source-code" id="M000087-source">
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-identifier">translate_string</span>(<span class="ruby-identifier">arg</span>)
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-M000089" class="method-detail">
297
- <a name="M000089"></a>
302
+ <div id="method-M000126" class="method-detail">
303
+ <a name="M000126"></a>
298
304
 
299
305
  <div class="method-heading">
300
- <a href="#M000089" class="method-signature">
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('M000089-source');return false;">[Source]</a></p>
308
- <div class="method-source-code" id="M000089-source">
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 139</span>
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">&lt;&lt;</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">&lt;&lt;</span> <span class="ruby-ivar">@escape_l</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">expr_code</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@escape_r</span> <span class="ruby-comment cmt"># ex. &lt;%=h expr_code %&gt;</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">&lt;&lt;</span> <span class="ruby-ivar">@expr_l</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">expr_code</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-ivar">@expr_r</span> <span class="ruby-comment cmt"># ex. &lt;%= expr_code %&gt;</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">&lt;&lt;</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">&lt;&lt;</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">&lt;&lt;</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 &lt;&lt; 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="#M000003">is_alpha</a>&nbsp;&nbsp;
84
- <a href="#M000004">is_digit</a>&nbsp;&nbsp;
85
- <a href="#M000005">is_identchar</a>&nbsp;&nbsp;
86
- <a href="#M000002">is_whitespace</a>&nbsp;&nbsp;
83
+ <a href="#M000019">is_alpha</a>&nbsp;&nbsp;
84
+ <a href="#M000020">is_digit</a>&nbsp;&nbsp;
85
+ <a href="#M000021">is_identchar</a>&nbsp;&nbsp;
86
+ <a href="#M000018">is_whitespace</a>&nbsp;&nbsp;
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-M000003" class="method-detail">
109
- <a name="M000003"></a>
108
+ <div id="method-M000019" class="method-detail">
109
+ <a name="M000019"></a>
110
110
 
111
111
  <div class="method-heading">
112
- <a href="#M000003" class="method-signature">
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('M000003-source');return false;">[Source]</a></p>
120
- <div class="method-source-code" id="M000003-source">
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-M000004" class="method-detail">
132
- <a name="M000004"></a>
131
+ <div id="method-M000020" class="method-detail">
132
+ <a name="M000020"></a>
133
133
 
134
134
  <div class="method-heading">
135
- <a href="#M000004" class="method-signature">
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('M000004-source');return false;">[Source]</a></p>
143
- <div class="method-source-code" id="M000004-source">
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-M000005" class="method-detail">
155
- <a name="M000005"></a>
154
+ <div id="method-M000021" class="method-detail">
155
+ <a name="M000021"></a>
156
156
 
157
157
  <div class="method-heading">
158
- <a href="#M000005" class="method-signature">
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('M000005-source');return false;">[Source]</a></p>
166
- <div class="method-source-code" id="M000005-source">
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-M000002" class="method-detail">
178
- <a name="M000002"></a>
177
+ <div id="method-M000018" class="method-detail">
178
+ <a name="M000018"></a>
179
179
 
180
180
  <div class="method-heading">
181
- <a href="#M000002" class="method-signature">
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('M000002-source');return false;">[Source]</a></p>
189
- <div class="method-source-code" id="M000002-source">
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>)