kwartz 3.1.2 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (140) hide show
  1. data/CHANGES +444 -0
  2. data/README.txt +4 -1
  3. data/bin/kwartz +2 -2
  4. data/doc-api/classes/Kwartz.html +16 -7
  5. data/doc-api/classes/Kwartz/Assertion.html +6 -6
  6. data/doc-api/classes/Kwartz/AssertionError.html +6 -6
  7. data/doc-api/classes/Kwartz/AttrInfo.html +71 -61
  8. data/doc-api/classes/Kwartz/BaseError.html +12 -12
  9. data/doc-api/classes/Kwartz/BaseTranslator.html +104 -74
  10. data/doc-api/classes/Kwartz/CharacterType.html +24 -24
  11. data/doc-api/classes/Kwartz/CommandOptionError.html +7 -7
  12. data/doc-api/classes/Kwartz/CommandOptions.html +50 -50
  13. data/doc-api/classes/Kwartz/Config.html +5 -0
  14. data/doc-api/classes/Kwartz/ConvertError.html +12 -12
  15. data/doc-api/classes/Kwartz/Converter.html +31 -33
  16. data/doc-api/classes/Kwartz/CssStyleParser.html +207 -168
  17. data/doc-api/classes/Kwartz/Defun.html +32 -31
  18. data/doc-api/classes/Kwartz/{HandlerArgument.html → Directive.html} +27 -53
  19. data/doc-api/classes/Kwartz/ElementInfo.html +68 -53
  20. data/doc-api/classes/Kwartz/EperlExpressionParser.html +185 -0
  21. data/doc-api/classes/Kwartz/EperlHandler.html +65 -58
  22. data/doc-api/classes/Kwartz/EperlTranslator.html +14 -7
  23. data/doc-api/classes/Kwartz/ErubisTranslator.html +14 -7
  24. data/doc-api/classes/Kwartz/ErubyTranslator.html +14 -7
  25. data/doc-api/classes/Kwartz/ExpandStatement.html +20 -20
  26. data/doc-api/classes/Kwartz/Expander.html +358 -0
  27. data/doc-api/classes/Kwartz/Handler.html +287 -157
  28. data/doc-api/classes/Kwartz/{StatementHelper.html → HandlerHelper.html} +307 -112
  29. data/doc-api/classes/Kwartz/Helper/ActionViewHelper.html +23 -23
  30. data/doc-api/classes/Kwartz/Helper/RailsTemplate.html +96 -96
  31. data/doc-api/classes/Kwartz/JstlExpressionParser.html +181 -0
  32. data/doc-api/classes/Kwartz/JstlHandler.html +134 -126
  33. data/doc-api/classes/Kwartz/JstlTranslator.html +21 -14
  34. data/doc-api/classes/Kwartz/KwartzError.html +6 -6
  35. data/doc-api/classes/Kwartz/Main.html +4 -4
  36. data/doc-api/classes/Kwartz/NativeExpression.html +19 -19
  37. data/doc-api/classes/Kwartz/NativeStatement.html +24 -24
  38. data/doc-api/classes/Kwartz/Node.html +7 -7
  39. data/doc-api/classes/Kwartz/PIErubisTranslator.html +21 -14
  40. data/doc-api/classes/Kwartz/ParseError.html +6 -6
  41. data/doc-api/classes/Kwartz/PerlExpressionParser.html +185 -0
  42. data/doc-api/classes/Kwartz/PerlHandler.html +353 -0
  43. data/doc-api/classes/Kwartz/PerlTranslator.html +226 -0
  44. data/doc-api/classes/Kwartz/PhpExpressionParser.html +185 -0
  45. data/doc-api/classes/Kwartz/PhpHandler.html +63 -56
  46. data/doc-api/classes/Kwartz/PhpTranslator.html +21 -14
  47. data/doc-api/classes/Kwartz/PresentationLogicParser.html +126 -123
  48. data/doc-api/classes/Kwartz/PrintStatement.html +18 -18
  49. data/doc-api/classes/Kwartz/RailsHandler.html +84 -85
  50. data/doc-api/classes/Kwartz/RailsTranslator.html +13 -6
  51. data/doc-api/classes/Kwartz/RubyExpressionParser.html +180 -0
  52. data/doc-api/classes/Kwartz/RubyHandler.html +73 -69
  53. data/doc-api/classes/Kwartz/RubyStyleParser.html +86 -86
  54. data/doc-api/classes/Kwartz/RubyTranslator.html +28 -21
  55. data/doc-api/classes/Kwartz/Ruleset.html +622 -1
  56. data/doc-api/classes/Kwartz/StrutsTranslator.html +14 -14
  57. data/doc-api/classes/Kwartz/TagInfo.html +52 -27
  58. data/doc-api/classes/Kwartz/TextConverter.html +75 -37
  59. data/doc-api/classes/Kwartz/Translator.html +54 -53
  60. data/doc-api/classes/Kwartz/Util.html +25 -25
  61. data/doc-api/created.rid +1 -1
  62. data/doc-api/files/__/README_txt.html +7 -2
  63. data/doc-api/files/kwartz/assert_rb.html +2 -2
  64. data/doc-api/files/kwartz/binding/eperl_rb.html +2 -2
  65. data/doc-api/files/kwartz/binding/erubis_rb.html +2 -2
  66. data/doc-api/files/kwartz/binding/eruby_rb.html +2 -2
  67. data/doc-api/files/kwartz/binding/jstl_rb.html +2 -2
  68. data/doc-api/files/kwartz/binding/perl_rb.html +115 -0
  69. data/doc-api/files/kwartz/binding/php_rb.html +2 -2
  70. data/doc-api/files/kwartz/binding/pierubis_rb.html +2 -2
  71. data/doc-api/files/kwartz/binding/rails_rb.html +2 -2
  72. data/doc-api/files/kwartz/binding/ruby_rb.html +2 -2
  73. data/doc-api/files/kwartz/binding/struts_rb.html +2 -2
  74. data/doc-api/files/kwartz/config_rb.html +2 -2
  75. data/doc-api/files/kwartz/converter_rb.html +2 -2
  76. data/doc-api/files/kwartz/defun_rb.html +2 -2
  77. data/doc-api/files/kwartz/error_rb.html +2 -2
  78. data/doc-api/files/kwartz/helper/rails_rb.html +2 -2
  79. data/doc-api/files/kwartz/main_rb.html +3 -2
  80. data/doc-api/files/kwartz/node_rb.html +2 -2
  81. data/doc-api/files/kwartz/parser_rb.html +2 -2
  82. data/doc-api/files/kwartz/translator_rb.html +2 -2
  83. data/doc-api/files/kwartz/util/assert-text-equal_rb.html +2 -2
  84. data/doc-api/files/kwartz/util/testcase-helper_rb.html +2 -2
  85. data/doc-api/files/kwartz/util_rb.html +2 -2
  86. data/doc-api/files/kwartz_rb.html +2 -2
  87. data/doc-api/fr_class_index.html +10 -5
  88. data/doc-api/fr_file_index.html +1 -0
  89. data/doc-api/fr_method_index.html +268 -239
  90. data/doc/docstyle.css +9 -3
  91. data/doc/img/fig05.png +0 -0
  92. data/doc/introduction-to-kwartz.html +3040 -0
  93. data/doc/pattern-catalog.html +5 -3
  94. data/doc/reference.html +680 -26
  95. data/doc/users-guide.html +222 -67
  96. data/kwartz.gemspec +4 -4
  97. data/lib/kwartz.rb +3 -3
  98. data/lib/kwartz/assert.rb +2 -2
  99. data/lib/kwartz/binding/eperl.rb +71 -31
  100. data/lib/kwartz/binding/erubis.rb +3 -2
  101. data/lib/kwartz/binding/eruby.rb +3 -2
  102. data/lib/kwartz/binding/jstl.rb +66 -29
  103. data/lib/kwartz/binding/perl.rb +230 -0
  104. data/lib/kwartz/binding/php.rb +69 -29
  105. data/lib/kwartz/binding/pierubis.rb +3 -2
  106. data/lib/kwartz/binding/rails.rb +18 -18
  107. data/lib/kwartz/binding/ruby.rb +74 -42
  108. data/lib/kwartz/binding/struts.rb +22 -21
  109. data/lib/kwartz/config.rb +4 -4
  110. data/lib/kwartz/converter.rb +465 -345
  111. data/lib/kwartz/defun.rb +2 -2
  112. data/lib/kwartz/error.rb +2 -2
  113. data/lib/kwartz/helper/rails.rb +2 -2
  114. data/lib/kwartz/main.rb +5 -4
  115. data/lib/kwartz/node.rb +92 -144
  116. data/lib/kwartz/parser.rb +112 -103
  117. data/lib/kwartz/translator.rb +14 -6
  118. data/lib/kwartz/util.rb +2 -2
  119. data/lib/kwartz/util/assert-text-equal.rb +2 -2
  120. data/lib/kwartz/util/testcase-helper.rb +1 -1
  121. data/test/test-compile.rb +2 -2
  122. data/test/test-compile.yaml +81 -0
  123. data/test/test-converter.rb +4 -8
  124. data/test/test-converter.yaml +152 -3
  125. data/test/test-directives.rb +2 -2
  126. data/test/test-directives.yaml +222 -0
  127. data/test/test-main.rb +6 -4
  128. data/test/test-main.yaml +66 -1
  129. data/test/test-parser.rb +12 -3
  130. data/test/test-parser.yaml +64 -51
  131. data/test/test-rails.rb +2 -2
  132. data/test/test-ruleset.rb +2 -2
  133. data/test/test-ruleset.yaml +465 -4
  134. data/test/test.log +6 -0
  135. data/test/test.rb +2 -2
  136. metadata +116 -106
  137. data/ChangeLog +0 -156
  138. data/doc-api/classes/Kwartz/DocumentRuleset.html +0 -369
  139. data/doc-api/classes/Kwartz/ElementExpander.html +0 -325
  140. data/doc-api/classes/Kwartz/ElementRuleset.html +0 -612
@@ -0,0 +1,226 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
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: Kwartz::PerlTranslator</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
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">Kwartz::PerlTranslator</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/kwartz/binding/perl_rb.html">
59
+ kwartz/binding/perl.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ <a href="BaseTranslator.html">
69
+ BaseTranslator
70
+ </a>
71
+ </td>
72
+ </tr>
73
+ </table>
74
+ </div>
75
+ <!-- banner header -->
76
+
77
+ <div id="bodyContent">
78
+
79
+
80
+
81
+ <div id="contextContent">
82
+
83
+ <div id="description">
84
+ <p>
85
+ translator for Perl
86
+ </p>
87
+
88
+ </div>
89
+
90
+
91
+ </div>
92
+
93
+ <div id="method-list">
94
+ <h3 class="section-bar">Methods</h3>
95
+
96
+ <div class="name-list">
97
+ <a href="#M000218">new</a>&nbsp;&nbsp;
98
+ <a href="#M000220">translate</a>&nbsp;&nbsp;
99
+ <a href="#M000219">translate_string</a>&nbsp;&nbsp;
100
+ </div>
101
+ </div>
102
+
103
+ </div>
104
+
105
+
106
+ <!-- if includes -->
107
+ <div id="includes">
108
+ <h3 class="section-bar">Included Modules</h3>
109
+
110
+ <div id="includes-list">
111
+ <span class="include-name"><a href="PerlExpressionParser.html">PerlExpressionParser</a></span>
112
+ </div>
113
+ </div>
114
+
115
+ <div id="section">
116
+
117
+
118
+
119
+
120
+
121
+
122
+
123
+
124
+ <!-- if method_list -->
125
+ <div id="methods">
126
+ <h3 class="section-bar">Public Class methods</h3>
127
+
128
+ <div id="method-M000218" class="method-detail">
129
+ <a name="M000218"></a>
130
+
131
+ <div class="method-heading">
132
+ <a href="#M000218" class="method-signature">
133
+ <span class="method-name">new</span><span class="method-args">(properties={})</span>
134
+ </a>
135
+ </div>
136
+
137
+ <div class="method-description">
138
+ <p><a class="source-toggle" href="#"
139
+ onclick="toggleCode('M000218-source');return false;">[Source]</a></p>
140
+ <div class="method-source-code" id="M000218-source">
141
+ <pre>
142
+ <span class="ruby-comment cmt"># File kwartz/binding/perl.rb, line 195</span>
143
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">properties</span>={})
144
+ <span class="ruby-identifier">escapefunc</span> = <span class="ruby-identifier">properties</span>[<span class="ruby-identifier">:escapefunc</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">'encode_entities'</span>
145
+ <span class="ruby-identifier">marks</span> = [<span class="ruby-value str">''</span>, <span class="ruby-value str">''</span>, <span class="ruby-value str">'push(@_buf, '</span>, <span class="ruby-value str">'); '</span>, <span class="ruby-node">&quot;push(@_buf, #{escapefunc}(&quot;</span>, <span class="ruby-value str">')); '</span>]
146
+ <span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">marks</span>, <span class="ruby-identifier">properties</span>)
147
+ <span class="ruby-ivar">@header</span> = <span class="ruby-value str">'my @_buf = (); '</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@header</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">false</span>
148
+ <span class="ruby-ivar">@footer</span> = <span class="ruby-value str">&quot;join('', @_buf);&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@nl</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@footer</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">false</span>
149
+ <span class="ruby-keyword kw">end</span>
150
+ </pre>
151
+ </div>
152
+ </div>
153
+ </div>
154
+
155
+ <h3 class="section-bar">Public Instance methods</h3>
156
+
157
+ <div id="method-M000220" class="method-detail">
158
+ <a name="M000220"></a>
159
+
160
+ <div class="method-heading">
161
+ <a href="#M000220" class="method-signature">
162
+ <span class="method-name">translate</span><span class="method-args">(stmt_list)</span>
163
+ </a>
164
+ </div>
165
+
166
+ <div class="method-description">
167
+ <p><a class="source-toggle" href="#"
168
+ onclick="toggleCode('M000220-source');return false;">[Source]</a></p>
169
+ <div class="method-source-code" id="M000220-source">
170
+ <pre>
171
+ <span class="ruby-comment cmt"># File kwartz/binding/perl.rb, line 219</span>
172
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">translate</span>(<span class="ruby-identifier">stmt_list</span>)
173
+ <span class="ruby-identifier">stmt_list2</span> = <span class="ruby-identifier">optimize_print_stmts</span>(<span class="ruby-identifier">stmt_list</span>)
174
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">stmt_list2</span>)
175
+ <span class="ruby-keyword kw">end</span>
176
+ </pre>
177
+ </div>
178
+ </div>
179
+ </div>
180
+
181
+ <div id="method-M000219" class="method-detail">
182
+ <a name="M000219"></a>
183
+
184
+ <div class="method-heading">
185
+ <a href="#M000219" class="method-signature">
186
+ <span class="method-name">translate_string</span><span class="method-args">(str)</span>
187
+ </a>
188
+ </div>
189
+
190
+ <div class="method-description">
191
+ <p><a class="source-toggle" href="#"
192
+ onclick="toggleCode('M000219-source');return false;">[Source]</a></p>
193
+ <div class="method-source-code" id="M000219-source">
194
+ <pre>
195
+ <span class="ruby-comment cmt"># File kwartz/binding/perl.rb, line 204</span>
196
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">translate_string</span>(<span class="ruby-identifier">str</span>)
197
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">str</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">str</span>.<span class="ruby-identifier">empty?</span>
198
+ <span class="ruby-comment cmt">#str.gsub!(/['\\]/, '\\\\\&amp;')</span>
199
+ <span class="ruby-comment cmt">#@sb &lt;&lt; &quot;_buf &lt;&lt; '#{str}'; &quot;</span>
200
+ <span class="ruby-identifier">str</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/[`\\]/</span>, <span class="ruby-value str">'\\\\\&amp;'</span>)
201
+ <span class="ruby-ivar">@sb</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;push(@_buf, q`#{str}`); &quot;</span>
202
+ <span class="ruby-comment cmt">#if str[-1] == ?\n</span>
203
+ <span class="ruby-comment cmt"># str.chomp!</span>
204
+ <span class="ruby-comment cmt"># @sb &lt;&lt; &quot;push(@_buf, q`#{str}`, #{@nl.inspect});&quot; &lt;&lt; @nl</span>
205
+ <span class="ruby-comment cmt">#else</span>
206
+ <span class="ruby-comment cmt"># @sb &lt;&lt; &quot;push(@_buf, q`#{str}`); &quot;</span>
207
+ <span class="ruby-comment cmt">#end</span>
208
+ <span class="ruby-keyword kw">end</span>
209
+ </pre>
210
+ </div>
211
+ </div>
212
+ </div>
213
+
214
+
215
+ </div>
216
+
217
+
218
+ </div>
219
+
220
+
221
+ <div id="validator-badges">
222
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
223
+ </div>
224
+
225
+ </body>
226
+ </html>
@@ -0,0 +1,185 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
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>Module: Kwartz::PhpExpressionParser</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
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>Module</strong></td>
53
+ <td class="class-name-in-header">Kwartz::PhpExpressionParser</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/kwartz/binding/php_rb.html">
59
+ kwartz/binding/php.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ </table>
66
+ </div>
67
+ <!-- banner header -->
68
+
69
+ <div id="bodyContent">
70
+
71
+
72
+
73
+ <div id="contextContent">
74
+
75
+
76
+
77
+ </div>
78
+
79
+ <div id="method-list">
80
+ <h3 class="section-bar">Methods</h3>
81
+
82
+ <div class="name-list">
83
+ <a href="#M000036">parse_expr_str</a>&nbsp;&nbsp;
84
+ <a href="#M000037">parse_expr_str!</a>&nbsp;&nbsp;
85
+ </div>
86
+ </div>
87
+
88
+ </div>
89
+
90
+
91
+ <!-- if includes -->
92
+
93
+ <div id="section">
94
+
95
+
96
+
97
+
98
+
99
+
100
+
101
+
102
+ <!-- if method_list -->
103
+ <div id="methods">
104
+ <h3 class="section-bar">Public Instance methods</h3>
105
+
106
+ <div id="method-M000036" class="method-detail">
107
+ <a name="M000036"></a>
108
+
109
+ <div class="method-heading">
110
+ <a href="#M000036" class="method-signature">
111
+ <span class="method-name">parse_expr_str</span><span class="method-args">(expr_str, linenum)</span>
112
+ </a>
113
+ </div>
114
+
115
+ <div class="method-description">
116
+ <p><a class="source-toggle" href="#"
117
+ onclick="toggleCode('M000036-source');return false;">[Source]</a></p>
118
+ <div class="method-source-code" id="M000036-source">
119
+ <pre>
120
+ <span class="ruby-comment cmt"># File kwartz/binding/php.rb, line 20</span>
121
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse_expr_str</span>(<span class="ruby-identifier">expr_str</span>, <span class="ruby-identifier">linenum</span>)
122
+ <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">expr_str</span>
123
+ <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">/\A(\w+)\z/</span> <span class="ruby-comment cmt"># variable</span>
124
+ <span class="ruby-identifier">expr</span> = <span class="ruby-value str">'$'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">$1</span>
125
+ <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">/\A(\w+)\.(\w+)\z/</span> <span class="ruby-comment cmt"># object.property</span>
126
+ <span class="ruby-identifier">expr</span> = <span class="ruby-node">&quot;$#{$1}-&gt;#{$2}&quot;</span>
127
+ <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">/\A(\w+)\[('.*?'|&quot;.*?&quot;|:\w+)\]\z/</span> <span class="ruby-comment cmt"># hash</span>
128
+ <span class="ruby-identifier">key</span> = <span class="ruby-identifier">$2</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-value">?:</span> <span class="ruby-operator">?</span> <span class="ruby-node">&quot;'#{$2[1..-1]}'&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">$2</span>
129
+ <span class="ruby-identifier">expr</span> = <span class="ruby-node">&quot;$#{$1}[#{key}]&quot;</span>
130
+ <span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">/\A(\w+)\[(\w+)\]\z/</span> <span class="ruby-comment cmt"># array or hash</span>
131
+ <span class="ruby-keyword kw">begin</span>
132
+ <span class="ruby-identifier">expr</span> = <span class="ruby-node">&quot;$#{$1}[#{Integer($2)}]&quot;</span>
133
+ <span class="ruby-keyword kw">rescue</span>
134
+ <span class="ruby-identifier">expr</span> = <span class="ruby-node">&quot;$#{$1}[$#{$2}]&quot;</span>
135
+ <span class="ruby-keyword kw">end</span>
136
+ <span class="ruby-keyword kw">else</span>
137
+ <span class="ruby-identifier">raise</span> <span class="ruby-identifier">convert_error</span>(<span class="ruby-node">&quot;'#{expr_str}': invalid expression.&quot;</span>, <span class="ruby-identifier">linenum</span>)
138
+ <span class="ruby-keyword kw">end</span>
139
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">expr</span>
140
+ <span class="ruby-keyword kw">end</span>
141
+ </pre>
142
+ </div>
143
+ </div>
144
+ </div>
145
+
146
+ <div id="method-M000037" class="method-detail">
147
+ <a name="M000037"></a>
148
+
149
+ <div class="method-heading">
150
+ <a href="#M000037" class="method-signature">
151
+ <span class="method-name">parse_expr_str!</span><span class="method-args">(expr_str)</span>
152
+ </a>
153
+ </div>
154
+
155
+ <div class="method-description">
156
+ <p><a class="source-toggle" href="#"
157
+ onclick="toggleCode('M000037-source');return false;">[Source]</a></p>
158
+ <div class="method-source-code" id="M000037-source">
159
+ <pre>
160
+ <span class="ruby-comment cmt"># File kwartz/binding/php.rb, line 42</span>
161
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse_expr_str!</span>(<span class="ruby-identifier">expr_str</span>)
162
+ <span class="ruby-keyword kw">begin</span>
163
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">parse_expr_str</span>(<span class="ruby-identifier">expr_str</span>, <span class="ruby-value">0</span>)
164
+ <span class="ruby-keyword kw">rescue</span>
165
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">expr_str</span>
166
+ <span class="ruby-keyword kw">end</span>
167
+ <span class="ruby-keyword kw">end</span>
168
+ </pre>
169
+ </div>
170
+ </div>
171
+ </div>
172
+
173
+
174
+ </div>
175
+
176
+
177
+ </div>
178
+
179
+
180
+ <div id="validator-badges">
181
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
182
+ </div>
183
+
184
+ </body>
185
+ </html>
@@ -94,10 +94,10 @@ directive handler for PHP
94
94
  <h3 class="section-bar">Methods</h3>
95
95
 
96
96
  <div class="name-list">
97
- <a href="#M000061">directive_format</a>&nbsp;&nbsp;
98
- <a href="#M000059">directive_pattern</a>&nbsp;&nbsp;
99
- <a href="#M000062">handle</a>&nbsp;&nbsp;
100
- <a href="#M000060">mapping_pattern</a>&nbsp;&nbsp;
97
+ <a href="#M000216">directive_format</a>&nbsp;&nbsp;
98
+ <a href="#M000214">directive_pattern</a>&nbsp;&nbsp;
99
+ <a href="#M000217">handle</a>&nbsp;&nbsp;
100
+ <a href="#M000215">mapping_pattern</a>&nbsp;&nbsp;
101
101
  </div>
102
102
  </div>
103
103
 
@@ -105,6 +105,13 @@ directive handler for PHP
105
105
 
106
106
 
107
107
  <!-- if includes -->
108
+ <div id="includes">
109
+ <h3 class="section-bar">Included Modules</h3>
110
+
111
+ <div id="includes-list">
112
+ <span class="include-name"><a href="PhpExpressionParser.html">PhpExpressionParser</a></span>
113
+ </div>
114
+ </div>
108
115
 
109
116
  <div id="section">
110
117
 
@@ -142,21 +149,21 @@ directive handler for PHP
142
149
  <div id="methods">
143
150
  <h3 class="section-bar">Public Instance methods</h3>
144
151
 
145
- <div id="method-M000061" class="method-detail">
146
- <a name="M000061"></a>
152
+ <div id="method-M000216" class="method-detail">
153
+ <a name="M000216"></a>
147
154
 
148
155
  <div class="method-heading">
149
- <a href="#M000061" class="method-signature">
156
+ <a href="#M000216" class="method-signature">
150
157
  <span class="method-name">directive_format</span><span class="method-args">()</span>
151
158
  </a>
152
159
  </div>
153
160
 
154
161
  <div class="method-description">
155
162
  <p><a class="source-toggle" href="#"
156
- onclick="toggleCode('M000061-source');return false;">[Source]</a></p>
157
- <div class="method-source-code" id="M000061-source">
163
+ onclick="toggleCode('M000216-source');return false;">[Source]</a></p>
164
+ <div class="method-source-code" id="M000216-source">
158
165
  <pre>
159
- <span class="ruby-comment cmt"># File kwartz/binding/php.rb, line 39</span>
166
+ <span class="ruby-comment cmt"># File kwartz/binding/php.rb, line 78</span>
160
167
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">directive_format</span>
161
168
  <span class="ruby-keyword kw">return</span> <span class="ruby-constant">PHP_DIRECTIVE_FORMAT</span>
162
169
  <span class="ruby-keyword kw">end</span>
@@ -165,21 +172,21 @@ directive handler for PHP
165
172
  </div>
166
173
  </div>
167
174
 
168
- <div id="method-M000059" class="method-detail">
169
- <a name="M000059"></a>
175
+ <div id="method-M000214" class="method-detail">
176
+ <a name="M000214"></a>
170
177
 
171
178
  <div class="method-heading">
172
- <a href="#M000059" class="method-signature">
179
+ <a href="#M000214" class="method-signature">
173
180
  <span class="method-name">directive_pattern</span><span class="method-args">()</span>
174
181
  </a>
175
182
  </div>
176
183
 
177
184
  <div class="method-description">
178
185
  <p><a class="source-toggle" href="#"
179
- onclick="toggleCode('M000059-source');return false;">[Source]</a></p>
180
- <div class="method-source-code" id="M000059-source">
186
+ onclick="toggleCode('M000214-source');return false;">[Source]</a></p>
187
+ <div class="method-source-code" id="M000214-source">
181
188
  <pre>
182
- <span class="ruby-comment cmt"># File kwartz/binding/php.rb, line 25</span>
189
+ <span class="ruby-comment cmt"># File kwartz/binding/php.rb, line 64</span>
183
190
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">directive_pattern</span>
184
191
  <span class="ruby-keyword kw">return</span> <span class="ruby-constant">PHP_DIRECTIVE_PATTERN</span>
185
192
  <span class="ruby-keyword kw">end</span>
@@ -188,36 +195,36 @@ directive handler for PHP
188
195
  </div>
189
196
  </div>
190
197
 
191
- <div id="method-M000062" class="method-detail">
192
- <a name="M000062"></a>
198
+ <div id="method-M000217" class="method-detail">
199
+ <a name="M000217"></a>
193
200
 
194
201
  <div class="method-heading">
195
- <a href="#M000062" class="method-signature">
196
- <span class="method-name">handle</span><span class="method-args">(stmt_list, handler_arg)</span>
202
+ <a href="#M000217" class="method-signature">
203
+ <span class="method-name">handle</span><span class="method-args">(directive, elem_info, stmt_list)</span>
197
204
  </a>
198
205
  </div>
199
206
 
200
207
  <div class="method-description">
201
208
  <p><a class="source-toggle" href="#"
202
- onclick="toggleCode('M000062-source');return false;">[Source]</a></p>
203
- <div class="method-source-code" id="M000062-source">
209
+ onclick="toggleCode('M000217-source');return false;">[Source]</a></p>
210
+ <div class="method-source-code" id="M000217-source">
204
211
  <pre>
205
- <span class="ruby-comment cmt"># File kwartz/binding/php.rb, line 44</span>
206
- <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">handle</span>(<span class="ruby-identifier">stmt_list</span>, <span class="ruby-identifier">handler_arg</span>)
212
+ <span class="ruby-comment cmt"># File kwartz/binding/php.rb, line 83</span>
213
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">handle</span>(<span class="ruby-identifier">directive</span>, <span class="ruby-identifier">elem_info</span>, <span class="ruby-identifier">stmt_list</span>)
207
214
  <span class="ruby-identifier">ret</span> = <span class="ruby-keyword kw">super</span>
208
215
  <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">ret</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ret</span>
209
216
 
210
- <span class="ruby-identifier">arg</span> = <span class="ruby-identifier">handler_arg</span>
211
- <span class="ruby-identifier">d_name</span> = <span class="ruby-identifier">arg</span>.<span class="ruby-identifier">directive_name</span>
212
- <span class="ruby-identifier">d_arg</span> = <span class="ruby-identifier">arg</span>.<span class="ruby-identifier">directive_arg</span>
213
- <span class="ruby-identifier">d_str</span> = <span class="ruby-identifier">arg</span>.<span class="ruby-identifier">directive_str</span>
217
+ <span class="ruby-identifier">d_name</span> = <span class="ruby-identifier">directive</span>.<span class="ruby-identifier">name</span>
218
+ <span class="ruby-identifier">d_arg</span> = <span class="ruby-identifier">directive</span>.<span class="ruby-identifier">arg</span>
219
+ <span class="ruby-identifier">d_str</span> = <span class="ruby-identifier">directive</span>.<span class="ruby-identifier">str</span>
220
+ <span class="ruby-identifier">e</span> = <span class="ruby-identifier">elem_info</span>
214
221
 
215
222
  <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">d_name</span>
216
223
 
217
224
  <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:foreach</span>, <span class="ruby-identifier">:Foreach</span>, <span class="ruby-identifier">:FOREACH</span>, <span class="ruby-identifier">:list</span>, <span class="ruby-identifier">:List</span>, <span class="ruby-identifier">:LIST</span>
218
225
  <span class="ruby-identifier">is_foreach</span> = <span class="ruby-identifier">d_name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:foreach</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">d_name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:Foreach</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">d_name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:FOREACH</span>
219
226
  <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">d_arg</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/\A.*\s+as\s+(\$\w+)(?:\s*=&gt;\s*\$\w+)?\z/</span>
220
- <span class="ruby-identifier">raise</span> <span class="ruby-identifier">convert_error</span>(<span class="ruby-node">&quot;'#{d_str}': invalid argument.&quot;</span>, <span class="ruby-identifier">arg</span>.<span class="ruby-identifier">stag_info</span>.<span class="ruby-identifier">linenum</span>)
227
+ <span class="ruby-identifier">raise</span> <span class="ruby-identifier">convert_error</span>(<span class="ruby-node">&quot;'#{d_str}': invalid argument.&quot;</span>, <span class="ruby-identifier">elem_info</span>.<span class="ruby-identifier">stag_info</span>.<span class="ruby-identifier">linenum</span>)
221
228
  <span class="ruby-keyword kw">end</span>
222
229
  <span class="ruby-identifier">loopvar</span> = <span class="ruby-identifier">$1</span>
223
230
  <span class="ruby-identifier">counter</span> = <span class="ruby-identifier">d_name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:foreach</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">d_name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:list</span> <span class="ruby-operator">?</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-operator">:</span> <span class="ruby-node">&quot;#{loopvar}_ctr&quot;</span>
@@ -228,23 +235,23 @@ directive handler for PHP
228
235
  <span class="ruby-identifier">code</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot; #{counter}++;&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">counter</span>
229
236
  <span class="ruby-identifier">code</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot; #{toggle} = #{counter}%2==0 ? #{@even} : #{@odd};&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">toggle</span>
230
237
  <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">is_foreach</span>
231
- <span class="ruby-identifier">wrap_element_with_native_stmt</span>(<span class="ruby-identifier">stmt_list</span>, <span class="ruby-identifier">arg</span>, <span class="ruby-identifier">code</span>, <span class="ruby-value str">&quot;}&quot;</span>, <span class="ruby-identifier">:foeach</span>)
238
+ <span class="ruby-identifier">wrap_element_with_native_stmt</span>(<span class="ruby-identifier">elem_info</span>, <span class="ruby-identifier">stmt_list</span>, <span class="ruby-identifier">code</span>, <span class="ruby-value str">&quot;}&quot;</span>, <span class="ruby-identifier">:foeach</span>)
232
239
  <span class="ruby-keyword kw">else</span>
233
- <span class="ruby-identifier">wrap_content_with_native_stmt</span>(<span class="ruby-identifier">stmt_list</span>, <span class="ruby-identifier">arg</span>, <span class="ruby-identifier">code</span>, <span class="ruby-value str">&quot;}&quot;</span>, <span class="ruby-identifier">:foeach</span>)
240
+ <span class="ruby-identifier">wrap_content_with_native_stmt</span>(<span class="ruby-identifier">elem_info</span>, <span class="ruby-identifier">stmt_list</span>, <span class="ruby-identifier">code</span>, <span class="ruby-value str">&quot;}&quot;</span>, <span class="ruby-identifier">:foeach</span>)
234
241
  <span class="ruby-keyword kw">end</span>
235
- <span class="ruby-comment cmt">#stmt_list &lt;&lt; stag_stmt(arg) if !is_foreach</span>
242
+ <span class="ruby-comment cmt">#stmt_list &lt;&lt; stag_stmt(elem_info) if !is_foreach</span>
236
243
  <span class="ruby-comment cmt">#stmt_list &lt;&lt; NativeStatement.new(&quot;#{counter} = 0;&quot;) if counter</span>
237
244
  <span class="ruby-comment cmt">#stmt_list &lt;&lt; NativeStatement.new(&quot;foreach (#{d_arg}) {&quot;, :foreach)</span>
238
245
  <span class="ruby-comment cmt">#stmt_list &lt;&lt; NativeStatement.new(&quot; #{counter}++;&quot;) if counter</span>
239
246
  <span class="ruby-comment cmt">#stmt_list &lt;&lt; NativeStatement.new(&quot; #{toggle} = #{counter}%2==0 ? #{self.even} : #{self.odd};&quot;) if toggle</span>
240
- <span class="ruby-comment cmt">#stmt_list &lt;&lt; stag_stmt(arg) if is_foreach</span>
241
- <span class="ruby-comment cmt">#stmt_list.concat(arg.cont_stmts)</span>
242
- <span class="ruby-comment cmt">#stmt_list &lt;&lt; etag_stmt(arg) if is_foreach</span>
247
+ <span class="ruby-comment cmt">#stmt_list &lt;&lt; stag_stmt(elem_info) if is_foreach</span>
248
+ <span class="ruby-comment cmt">#stmt_list.concat(elem_info.cont_stmts)</span>
249
+ <span class="ruby-comment cmt">#stmt_list &lt;&lt; etag_stmt(elem_info) if is_foreach</span>
243
250
  <span class="ruby-comment cmt">#stmt_list &lt;&lt; NativeStatement.new(&quot;}&quot;, :foreach)</span>
244
- <span class="ruby-comment cmt">#stmt_list &lt;&lt; etag_stmt(arg) if !is_foreach</span>
251
+ <span class="ruby-comment cmt">#stmt_list &lt;&lt; etag_stmt(elem_info) if !is_foreach</span>
245
252
 
246
253
  <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:while</span>
247
- <span class="ruby-identifier">wrap_element_with_native_stmt</span>(<span class="ruby-identifier">stmt_list</span>, <span class="ruby-identifier">arg</span>, <span class="ruby-node">&quot;while (#{d_arg}) {&quot;</span>, <span class="ruby-value str">&quot;}&quot;</span>, <span class="ruby-identifier">:while</span>)
254
+ <span class="ruby-identifier">wrap_element_with_native_stmt</span>(<span class="ruby-identifier">elem_info</span>, <span class="ruby-identifier">stmt_list</span>, <span class="ruby-node">&quot;while (#{d_arg}) {&quot;</span>, <span class="ruby-value str">&quot;}&quot;</span>, <span class="ruby-identifier">:while</span>)
248
255
  <span class="ruby-comment cmt">#stmt_list &lt;&lt; NativeStatement.new(&quot;while (#{d_arg}) {&quot;, :while)</span>
249
256
  <span class="ruby-comment cmt">#stmt_list &lt;&lt; stag_stmt</span>
250
257
  <span class="ruby-comment cmt">#stmt_list.concat(cont_stmts)</span>
@@ -252,8 +259,8 @@ directive handler for PHP
252
259
  <span class="ruby-comment cmt">#stmt_list &lt;&lt; NativeStatement.new(&quot;}&quot;, :while)</span>
253
260
 
254
261
  <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:loop</span>
255
- <span class="ruby-identifier">error_if_empty_tag</span>(<span class="ruby-identifier">arg</span>)
256
- <span class="ruby-identifier">wrap_content_with_native_stmt</span>(<span class="ruby-identifier">stmt_list</span>, <span class="ruby-identifier">arg</span>, <span class="ruby-node">&quot;while (#{d_arg}) {&quot;</span>, <span class="ruby-value str">&quot;}&quot;</span>, <span class="ruby-identifier">:while</span>)
262
+ <span class="ruby-identifier">error_if_empty_tag</span>(<span class="ruby-identifier">elem_info</span>, <span class="ruby-identifier">d_str</span>)
263
+ <span class="ruby-identifier">wrap_content_with_native_stmt</span>(<span class="ruby-identifier">elem_info</span>, <span class="ruby-identifier">stmt_list</span>, <span class="ruby-node">&quot;while (#{d_arg}) {&quot;</span>, <span class="ruby-value str">&quot;}&quot;</span>, <span class="ruby-identifier">:while</span>)
257
264
  <span class="ruby-comment cmt">#stmt_list &lt;&lt; stag_stmt</span>
258
265
  <span class="ruby-comment cmt">#stmt_list &lt;&lt; NativeStatement.new(&quot;while (#{d_arg}) {&quot;, :while)</span>
259
266
  <span class="ruby-comment cmt">#stmt_list.concat(cont_stmts)</span>
@@ -261,14 +268,14 @@ directive handler for PHP
261
268
  <span class="ruby-comment cmt">#stmt_list &lt;&lt; etag_stmt</span>
262
269
 
263
270
  <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:set</span>
264
- <span class="ruby-identifier">wrap_element_with_native_stmt</span>(<span class="ruby-identifier">stmt_list</span>, <span class="ruby-identifier">arg</span>, <span class="ruby-node">&quot;#{d_arg};&quot;</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">:set</span>)
271
+ <span class="ruby-identifier">wrap_element_with_native_stmt</span>(<span class="ruby-identifier">elem_info</span>, <span class="ruby-identifier">stmt_list</span>, <span class="ruby-node">&quot;#{d_arg};&quot;</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">:set</span>)
265
272
  <span class="ruby-comment cmt">#stmt_list &lt;&lt; NativeStatement.new(&quot;#{d_arg};&quot;, :set)</span>
266
273
  <span class="ruby-comment cmt">#stmt_list &lt;&lt; stag_stmt</span>
267
274
  <span class="ruby-comment cmt">#stmt_list.concat(cont_stmts)</span>
268
275
  <span class="ruby-comment cmt">#stmt_list &lt;&lt; etag_stmt</span>
269
276
 
270
277
  <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:if</span>
271
- <span class="ruby-identifier">wrap_element_with_native_stmt</span>(<span class="ruby-identifier">stmt_list</span>, <span class="ruby-identifier">arg</span>, <span class="ruby-node">&quot;if (#{d_arg}) {&quot;</span>, <span class="ruby-value str">&quot;}&quot;</span>, <span class="ruby-identifier">:if</span>)
278
+ <span class="ruby-identifier">wrap_element_with_native_stmt</span>(<span class="ruby-identifier">elem_info</span>, <span class="ruby-identifier">stmt_list</span>, <span class="ruby-node">&quot;if (#{d_arg}) {&quot;</span>, <span class="ruby-value str">&quot;}&quot;</span>, <span class="ruby-identifier">:if</span>)
272
279
  <span class="ruby-comment cmt">#stmt_list &lt;&lt; NativeStatement.new(&quot;if (#{d_arg}) {&quot;, :if)</span>
273
280
  <span class="ruby-comment cmt">#stmt_list &lt;&lt; stag_stmt</span>
274
281
  <span class="ruby-comment cmt">#stmt_list.concat(cont_stmts)</span>
@@ -276,11 +283,11 @@ directive handler for PHP
276
283
  <span class="ruby-comment cmt">#stmt_list &lt;&lt; NativeStatement.new(&quot;}&quot;, :if)</span>
277
284
 
278
285
  <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:elseif</span>, <span class="ruby-identifier">:else</span>
279
- <span class="ruby-identifier">error_when_last_stmt_is_not_if</span>(<span class="ruby-identifier">stmt_list</span>, <span class="ruby-identifier">arg</span>)
286
+ <span class="ruby-identifier">error_when_last_stmt_is_not_if</span>(<span class="ruby-identifier">elem_info</span>, <span class="ruby-identifier">d_str</span>, <span class="ruby-identifier">stmt_list</span>)
280
287
  <span class="ruby-identifier">stmt_list</span>.<span class="ruby-identifier">pop</span> <span class="ruby-comment cmt"># delete '}'</span>
281
288
  <span class="ruby-identifier">kind</span> = <span class="ruby-identifier">d_name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:else</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">:else</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">:elseif</span>
282
289
  <span class="ruby-identifier">code</span> = <span class="ruby-identifier">d_name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:else</span> <span class="ruby-operator">?</span> <span class="ruby-value str">&quot;} else {&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-node">&quot;} elseif (#{d_arg}) {&quot;</span>
283
- <span class="ruby-identifier">wrap_element_with_native_stmt</span>(<span class="ruby-identifier">stmt_list</span>, <span class="ruby-identifier">arg</span>, <span class="ruby-identifier">code</span>, <span class="ruby-value str">&quot;}&quot;</span>, <span class="ruby-identifier">kind</span>)
290
+ <span class="ruby-identifier">wrap_element_with_native_stmt</span>(<span class="ruby-identifier">elem_info</span>, <span class="ruby-identifier">stmt_list</span>, <span class="ruby-identifier">code</span>, <span class="ruby-value str">&quot;}&quot;</span>, <span class="ruby-identifier">kind</span>)
284
291
  <span class="ruby-comment cmt">#stmt_list &lt;&lt; NativeStatement.new(code, kind)</span>
285
292
  <span class="ruby-comment cmt">#stmt_list &lt;&lt; stag_stmt</span>
286
293
  <span class="ruby-comment cmt">#stmt_list.concat(cont_stmts)</span>
@@ -288,19 +295,19 @@ directive handler for PHP
288
295
  <span class="ruby-comment cmt">#stmt_list &lt;&lt; NativeStatement.new(&quot;}&quot;, kind)</span>
289
296
 
290
297
  <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:default</span>, <span class="ruby-identifier">:Default</span>, <span class="ruby-identifier">:DEFAULT</span>
291
- <span class="ruby-identifier">error_if_empty_tag</span>(<span class="ruby-identifier">arg</span>)
292
- <span class="ruby-identifier">expr_code</span> = <span class="ruby-identifier">d_arg</span>
298
+ <span class="ruby-identifier">error_if_empty_tag</span>(<span class="ruby-identifier">elem_info</span>, <span class="ruby-identifier">d_str</span>)
299
+ <span class="ruby-identifier">expr_str</span> = <span class="ruby-identifier">directive</span>.<span class="ruby-identifier">dattr</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'id'</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">parse_expr_str</span>(<span class="ruby-identifier">d_arg</span>, <span class="ruby-identifier">e</span>.<span class="ruby-identifier">stag_info</span>.<span class="ruby-identifier">linenum</span>) <span class="ruby-operator">:</span> <span class="ruby-identifier">d_arg</span>
293
300
  <span class="ruby-identifier">flag_escape</span> = <span class="ruby-identifier">d_name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:default</span> <span class="ruby-operator">?</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-operator">:</span> (<span class="ruby-identifier">d_name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:Default</span>)
294
- <span class="ruby-identifier">add_native_expr_with_default</span>(<span class="ruby-identifier">stmt_list</span>, <span class="ruby-identifier">arg</span>, <span class="ruby-identifier">expr_code</span>, <span class="ruby-identifier">flag_escape</span>,
295
- <span class="ruby-node">&quot;if (#{d_arg}) {&quot;</span>, <span class="ruby-value str">&quot;} else {&quot;</span>, <span class="ruby-value str">&quot;}&quot;</span>)
296
- <span class="ruby-comment cmt">#stmt_list &lt;&lt; stag_stmt(arg)</span>
301
+ <span class="ruby-identifier">add_native_expr_with_default</span>(<span class="ruby-identifier">elem_info</span>, <span class="ruby-identifier">stmt_list</span>, <span class="ruby-identifier">expr_str</span>, <span class="ruby-identifier">flag_escape</span>,
302
+ <span class="ruby-node">&quot;if (#{expr_str}) {&quot;</span>, <span class="ruby-value str">&quot;} else {&quot;</span>, <span class="ruby-value str">&quot;}&quot;</span>)
303
+ <span class="ruby-comment cmt">#stmt_list &lt;&lt; stag_stmt(elem_info)</span>
297
304
  <span class="ruby-comment cmt">#stmt_list &lt;&lt; NativeStatement.new_without_newline(&quot;if (#{d_arg}) {&quot;, :if)</span>
298
305
  <span class="ruby-comment cmt">#flag_escape = d_name == :default ? nil : (d_name == :Default)</span>
299
306
  <span class="ruby-comment cmt">#stmt_list &lt;&lt; PrintStatement.new([ NativeExpression.new(d_arg, flag_escape) ])</span>
300
307
  <span class="ruby-comment cmt">#stmt_list &lt;&lt; NativeStatement.new_without_newline(&quot;} else {&quot;, :else)</span>
301
- <span class="ruby-comment cmt">#stmt_list.concat(arg.cont_stmts)</span>
308
+ <span class="ruby-comment cmt">#stmt_list.concat(elem_info.cont_stmts)</span>
302
309
  <span class="ruby-comment cmt">#stmt_list &lt;&lt; NativeStatement.new_without_newline(&quot;}&quot;, :else)</span>
303
- <span class="ruby-comment cmt">#stmt_list &lt;&lt; etag_stmt(arg)</span>
310
+ <span class="ruby-comment cmt">#stmt_list &lt;&lt; etag_stmt(elem_info)</span>
304
311
 
305
312
  <span class="ruby-keyword kw">else</span>
306
313
  <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
@@ -314,21 +321,21 @@ directive handler for PHP
314
321
  </div>
315
322
  </div>
316
323
 
317
- <div id="method-M000060" class="method-detail">
318
- <a name="M000060"></a>
324
+ <div id="method-M000215" class="method-detail">
325
+ <a name="M000215"></a>
319
326
 
320
327
  <div class="method-heading">
321
- <a href="#M000060" class="method-signature">
328
+ <a href="#M000215" class="method-signature">
322
329
  <span class="method-name">mapping_pattern</span><span class="method-args">()</span>
323
330
  </a>
324
331
  </div>
325
332
 
326
333
  <div class="method-description">
327
334
  <p><a class="source-toggle" href="#"
328
- onclick="toggleCode('M000060-source');return false;">[Source]</a></p>
329
- <div class="method-source-code" id="M000060-source">
335
+ onclick="toggleCode('M000215-source');return false;">[Source]</a></p>
336
+ <div class="method-source-code" id="M000215-source">
330
337
  <pre>
331
- <span class="ruby-comment cmt"># File kwartz/binding/php.rb, line 32</span>
338
+ <span class="ruby-comment cmt"># File kwartz/binding/php.rb, line 71</span>
332
339
  <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mapping_pattern</span>
333
340
  <span class="ruby-keyword kw">return</span> <span class="ruby-constant">PHP_MAPPING_PATTERN</span>
334
341
  <span class="ruby-keyword kw">end</span>