kwartz 3.1.2 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES +444 -0
- data/README.txt +4 -1
- data/bin/kwartz +2 -2
- data/doc-api/classes/Kwartz.html +16 -7
- 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 +71 -61
- data/doc-api/classes/Kwartz/BaseError.html +12 -12
- data/doc-api/classes/Kwartz/BaseTranslator.html +104 -74
- 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 +50 -50
- data/doc-api/classes/Kwartz/Config.html +5 -0
- data/doc-api/classes/Kwartz/ConvertError.html +12 -12
- data/doc-api/classes/Kwartz/Converter.html +31 -33
- data/doc-api/classes/Kwartz/CssStyleParser.html +207 -168
- data/doc-api/classes/Kwartz/Defun.html +32 -31
- data/doc-api/classes/Kwartz/{HandlerArgument.html → Directive.html} +27 -53
- data/doc-api/classes/Kwartz/ElementInfo.html +68 -53
- data/doc-api/classes/Kwartz/EperlExpressionParser.html +185 -0
- data/doc-api/classes/Kwartz/EperlHandler.html +65 -58
- data/doc-api/classes/Kwartz/EperlTranslator.html +14 -7
- data/doc-api/classes/Kwartz/ErubisTranslator.html +14 -7
- data/doc-api/classes/Kwartz/ErubyTranslator.html +14 -7
- data/doc-api/classes/Kwartz/ExpandStatement.html +20 -20
- data/doc-api/classes/Kwartz/Expander.html +358 -0
- data/doc-api/classes/Kwartz/Handler.html +287 -157
- data/doc-api/classes/Kwartz/{StatementHelper.html → HandlerHelper.html} +307 -112
- data/doc-api/classes/Kwartz/Helper/ActionViewHelper.html +23 -23
- data/doc-api/classes/Kwartz/Helper/RailsTemplate.html +96 -96
- data/doc-api/classes/Kwartz/JstlExpressionParser.html +181 -0
- data/doc-api/classes/Kwartz/JstlHandler.html +134 -126
- data/doc-api/classes/Kwartz/JstlTranslator.html +21 -14
- data/doc-api/classes/Kwartz/KwartzError.html +6 -6
- data/doc-api/classes/Kwartz/Main.html +4 -4
- data/doc-api/classes/Kwartz/NativeExpression.html +19 -19
- data/doc-api/classes/Kwartz/NativeStatement.html +24 -24
- data/doc-api/classes/Kwartz/Node.html +7 -7
- data/doc-api/classes/Kwartz/PIErubisTranslator.html +21 -14
- data/doc-api/classes/Kwartz/ParseError.html +6 -6
- data/doc-api/classes/Kwartz/PerlExpressionParser.html +185 -0
- data/doc-api/classes/Kwartz/PerlHandler.html +353 -0
- data/doc-api/classes/Kwartz/PerlTranslator.html +226 -0
- data/doc-api/classes/Kwartz/PhpExpressionParser.html +185 -0
- data/doc-api/classes/Kwartz/PhpHandler.html +63 -56
- data/doc-api/classes/Kwartz/PhpTranslator.html +21 -14
- data/doc-api/classes/Kwartz/PresentationLogicParser.html +126 -123
- data/doc-api/classes/Kwartz/PrintStatement.html +18 -18
- data/doc-api/classes/Kwartz/RailsHandler.html +84 -85
- data/doc-api/classes/Kwartz/RailsTranslator.html +13 -6
- data/doc-api/classes/Kwartz/RubyExpressionParser.html +180 -0
- data/doc-api/classes/Kwartz/RubyHandler.html +73 -69
- data/doc-api/classes/Kwartz/RubyStyleParser.html +86 -86
- data/doc-api/classes/Kwartz/RubyTranslator.html +28 -21
- data/doc-api/classes/Kwartz/Ruleset.html +622 -1
- data/doc-api/classes/Kwartz/StrutsTranslator.html +14 -14
- data/doc-api/classes/Kwartz/TagInfo.html +52 -27
- data/doc-api/classes/Kwartz/TextConverter.html +75 -37
- data/doc-api/classes/Kwartz/Translator.html +54 -53
- data/doc-api/classes/Kwartz/Util.html +25 -25
- data/doc-api/created.rid +1 -1
- data/doc-api/files/__/README_txt.html +7 -2
- data/doc-api/files/kwartz/assert_rb.html +2 -2
- data/doc-api/files/kwartz/binding/eperl_rb.html +2 -2
- data/doc-api/files/kwartz/binding/erubis_rb.html +2 -2
- data/doc-api/files/kwartz/binding/eruby_rb.html +2 -2
- data/doc-api/files/kwartz/binding/jstl_rb.html +2 -2
- data/doc-api/files/kwartz/binding/perl_rb.html +115 -0
- data/doc-api/files/kwartz/binding/php_rb.html +2 -2
- data/doc-api/files/kwartz/binding/pierubis_rb.html +2 -2
- data/doc-api/files/kwartz/binding/rails_rb.html +2 -2
- data/doc-api/files/kwartz/binding/ruby_rb.html +2 -2
- data/doc-api/files/kwartz/binding/struts_rb.html +2 -2
- data/doc-api/files/kwartz/config_rb.html +2 -2
- data/doc-api/files/kwartz/converter_rb.html +2 -2
- data/doc-api/files/kwartz/defun_rb.html +2 -2
- data/doc-api/files/kwartz/error_rb.html +2 -2
- data/doc-api/files/kwartz/helper/rails_rb.html +2 -2
- data/doc-api/files/kwartz/main_rb.html +3 -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 +2 -2
- data/doc-api/files/kwartz/util/testcase-helper_rb.html +2 -2
- data/doc-api/files/kwartz/util_rb.html +2 -2
- data/doc-api/files/kwartz_rb.html +2 -2
- data/doc-api/fr_class_index.html +10 -5
- data/doc-api/fr_file_index.html +1 -0
- data/doc-api/fr_method_index.html +268 -239
- data/doc/docstyle.css +9 -3
- data/doc/img/fig05.png +0 -0
- data/doc/introduction-to-kwartz.html +3040 -0
- data/doc/pattern-catalog.html +5 -3
- data/doc/reference.html +680 -26
- data/doc/users-guide.html +222 -67
- data/kwartz.gemspec +4 -4
- data/lib/kwartz.rb +3 -3
- data/lib/kwartz/assert.rb +2 -2
- data/lib/kwartz/binding/eperl.rb +71 -31
- data/lib/kwartz/binding/erubis.rb +3 -2
- data/lib/kwartz/binding/eruby.rb +3 -2
- data/lib/kwartz/binding/jstl.rb +66 -29
- data/lib/kwartz/binding/perl.rb +230 -0
- data/lib/kwartz/binding/php.rb +69 -29
- data/lib/kwartz/binding/pierubis.rb +3 -2
- data/lib/kwartz/binding/rails.rb +18 -18
- data/lib/kwartz/binding/ruby.rb +74 -42
- data/lib/kwartz/binding/struts.rb +22 -21
- data/lib/kwartz/config.rb +4 -4
- data/lib/kwartz/converter.rb +465 -345
- data/lib/kwartz/defun.rb +2 -2
- data/lib/kwartz/error.rb +2 -2
- data/lib/kwartz/helper/rails.rb +2 -2
- data/lib/kwartz/main.rb +5 -4
- data/lib/kwartz/node.rb +92 -144
- data/lib/kwartz/parser.rb +112 -103
- data/lib/kwartz/translator.rb +14 -6
- data/lib/kwartz/util.rb +2 -2
- data/lib/kwartz/util/assert-text-equal.rb +2 -2
- data/lib/kwartz/util/testcase-helper.rb +1 -1
- data/test/test-compile.rb +2 -2
- data/test/test-compile.yaml +81 -0
- data/test/test-converter.rb +4 -8
- data/test/test-converter.yaml +152 -3
- data/test/test-directives.rb +2 -2
- data/test/test-directives.yaml +222 -0
- data/test/test-main.rb +6 -4
- data/test/test-main.yaml +66 -1
- data/test/test-parser.rb +12 -3
- data/test/test-parser.yaml +64 -51
- data/test/test-rails.rb +2 -2
- data/test/test-ruleset.rb +2 -2
- data/test/test-ruleset.yaml +465 -4
- data/test/test.log +6 -0
- data/test/test.rb +2 -2
- metadata +116 -106
- data/ChangeLog +0 -156
- data/doc-api/classes/Kwartz/DocumentRuleset.html +0 -369
- data/doc-api/classes/Kwartz/ElementExpander.html +0 -325
- data/doc-api/classes/Kwartz/ElementRuleset.html +0 -612
@@ -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::EperlExpressionParser</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::EperlExpressionParser</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/kwartz/binding/eperl_rb.html">
|
59
|
+
kwartz/binding/eperl.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="#M000029">parse_expr_str</a>
|
84
|
+
<a href="#M000030">parse_expr_str!</a>
|
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-M000029" class="method-detail">
|
107
|
+
<a name="M000029"></a>
|
108
|
+
|
109
|
+
<div class="method-heading">
|
110
|
+
<a href="#M000029" 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('M000029-source');return false;">[Source]</a></p>
|
118
|
+
<div class="method-source-code" id="M000029-source">
|
119
|
+
<pre>
|
120
|
+
<span class="ruby-comment cmt"># File kwartz/binding/eperl.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">"$#{$1}->{#{$2}}"</span>
|
127
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">/\A(\w+)\[(.*?'|".*?"|:\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">"'#{$2[1..-1]}'"</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">$2</span>
|
129
|
+
<span class="ruby-identifier">expr</span> = <span class="ruby-node">"$#{$1}{#{key}}"</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">"$#{$1}[#{Integer($2)}]"</span>
|
133
|
+
<span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">ArgumentError</span>
|
134
|
+
<span class="ruby-identifier">expr</span> = <span class="ruby-node">"$#{$1}[$#{$2}]"</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">"'#{expr_str}': invalid expression."</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-M000030" class="method-detail">
|
147
|
+
<a name="M000030"></a>
|
148
|
+
|
149
|
+
<div class="method-heading">
|
150
|
+
<a href="#M000030" 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('M000030-source');return false;">[Source]</a></p>
|
158
|
+
<div class="method-source-code" id="M000030-source">
|
159
|
+
<pre>
|
160
|
+
<span class="ruby-comment cmt"># File kwartz/binding/eperl.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">-1</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 ePerl
|
|
94
94
|
<h3 class="section-bar">Methods</h3>
|
95
95
|
|
96
96
|
<div class="name-list">
|
97
|
-
<a href="#
|
98
|
-
<a href="#
|
99
|
-
<a href="#
|
100
|
-
<a href="#
|
97
|
+
<a href="#M000114">directive_format</a>
|
98
|
+
<a href="#M000112">directive_pattern</a>
|
99
|
+
<a href="#M000115">handle</a>
|
100
|
+
<a href="#M000113">mapping_pattern</a>
|
101
101
|
</div>
|
102
102
|
</div>
|
103
103
|
|
@@ -105,6 +105,13 @@ directive handler for ePerl
|
|
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="EperlExpressionParser.html">EperlExpressionParser</a></span>
|
113
|
+
</div>
|
114
|
+
</div>
|
108
115
|
|
109
116
|
<div id="section">
|
110
117
|
|
@@ -142,21 +149,21 @@ directive handler for ePerl
|
|
142
149
|
<div id="methods">
|
143
150
|
<h3 class="section-bar">Public Instance methods</h3>
|
144
151
|
|
145
|
-
<div id="method-
|
146
|
-
<a name="
|
152
|
+
<div id="method-M000114" class="method-detail">
|
153
|
+
<a name="M000114"></a>
|
147
154
|
|
148
155
|
<div class="method-heading">
|
149
|
-
<a href="#
|
156
|
+
<a href="#M000114" 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('
|
157
|
-
<div class="method-source-code" id="
|
163
|
+
onclick="toggleCode('M000114-source');return false;">[Source]</a></p>
|
164
|
+
<div class="method-source-code" id="M000114-source">
|
158
165
|
<pre>
|
159
|
-
<span class="ruby-comment cmt"># File kwartz/binding/eperl.rb, line
|
166
|
+
<span class="ruby-comment cmt"># File kwartz/binding/eperl.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">PERL_DIRECTIVE_FORMAT</span>
|
162
169
|
<span class="ruby-keyword kw">end</span>
|
@@ -165,21 +172,21 @@ directive handler for ePerl
|
|
165
172
|
</div>
|
166
173
|
</div>
|
167
174
|
|
168
|
-
<div id="method-
|
169
|
-
<a name="
|
175
|
+
<div id="method-M000112" class="method-detail">
|
176
|
+
<a name="M000112"></a>
|
170
177
|
|
171
178
|
<div class="method-heading">
|
172
|
-
<a href="#
|
179
|
+
<a href="#M000112" 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('
|
180
|
-
<div class="method-source-code" id="
|
186
|
+
onclick="toggleCode('M000112-source');return false;">[Source]</a></p>
|
187
|
+
<div class="method-source-code" id="M000112-source">
|
181
188
|
<pre>
|
182
|
-
<span class="ruby-comment cmt"># File kwartz/binding/eperl.rb, line
|
189
|
+
<span class="ruby-comment cmt"># File kwartz/binding/eperl.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">PERL_DIRECTIVE_PATTERN</span>
|
185
192
|
<span class="ruby-keyword kw">end</span>
|
@@ -188,36 +195,36 @@ directive handler for ePerl
|
|
188
195
|
</div>
|
189
196
|
</div>
|
190
197
|
|
191
|
-
<div id="method-
|
192
|
-
<a name="
|
198
|
+
<div id="method-M000115" class="method-detail">
|
199
|
+
<a name="M000115"></a>
|
193
200
|
|
194
201
|
<div class="method-heading">
|
195
|
-
<a href="#
|
196
|
-
<span class="method-name">handle</span><span class="method-args">(
|
202
|
+
<a href="#M000115" 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('
|
203
|
-
<div class="method-source-code" id="
|
209
|
+
onclick="toggleCode('M000115-source');return false;">[Source]</a></p>
|
210
|
+
<div class="method-source-code" id="M000115-source">
|
204
211
|
<pre>
|
205
|
-
<span class="ruby-comment cmt"># File kwartz/binding/eperl.rb, line
|
206
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">handle</span>(<span class="ruby-identifier">
|
212
|
+
<span class="ruby-comment cmt"># File kwartz/binding/eperl.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">
|
211
|
-
<span class="ruby-identifier">
|
212
|
-
<span class="ruby-identifier">
|
213
|
-
<span class="ruby-identifier">
|
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(\$\w+)(?:,\s*(\$\w+))?\s+in\s+(.*)\z/</span>
|
220
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-identifier">convert_error</span>(<span class="ruby-node">"'#{d_str}': invalid argument."</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">"'#{d_str}': invalid argument."</span>, <span class="ruby-identifier">e</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> ; <span class="ruby-identifier">loopval</span> = <span class="ruby-identifier">$2</span> ; <span class="ruby-identifier">looplist</span> = <span class="ruby-identifier">$3</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">"#{loopvar}_ctr"</span>
|
@@ -233,11 +240,11 @@ directive handler for ePerl
|
|
233
240
|
<span class="ruby-identifier">code</span> <span class="ruby-operator"><<</span> <span class="ruby-node">" #{counter}++;"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">counter</span>
|
234
241
|
<span class="ruby-identifier">code</span> <span class="ruby-operator"><<</span> <span class="ruby-node">" my #{toggle} = #{counter}%2==0 ? #{self.even} : #{self.odd};"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">toggle</span>
|
235
242
|
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">is_foreach</span>
|
236
|
-
<span class="ruby-identifier">wrap_element_with_native_stmt</span>(<span class="ruby-identifier">
|
243
|
+
<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">"}"</span>, <span class="ruby-identifier">:foreach</span>)
|
237
244
|
<span class="ruby-keyword kw">else</span>
|
238
|
-
<span class="ruby-identifier">wrap_content_with_native_stmt</span>(<span class="ruby-identifier">
|
245
|
+
<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">"}"</span>, <span class="ruby-identifier">:foreach</span>)
|
239
246
|
<span class="ruby-keyword kw">end</span>
|
240
|
-
<span class="ruby-comment cmt">#stmt_list << stag_stmt(
|
247
|
+
<span class="ruby-comment cmt">#stmt_list << stag_stmt(elem_info) if !is_foreach</span>
|
241
248
|
<span class="ruby-comment cmt">#stmt_list << NativeStatement.new("my #{counter} = 0;") if counter</span>
|
242
249
|
<span class="ruby-comment cmt">#if loopval</span>
|
243
250
|
<span class="ruby-comment cmt"># stmt_list << NativeStatement.new("foreach my #{loopvar} (keys #{looplist}) {", :foreach)</span>
|
@@ -247,23 +254,23 @@ directive handler for ePerl
|
|
247
254
|
<span class="ruby-comment cmt">#end</span>
|
248
255
|
<span class="ruby-comment cmt">#stmt_list << NativeStatement.new(" #{counter}++;") if counter</span>
|
249
256
|
<span class="ruby-comment cmt">#stmt_list << NativeStatement.new(" my #{toggle} = #{counter}%2==0 ? #{self.even} : #{self.odd};") if toggle</span>
|
250
|
-
<span class="ruby-comment cmt">#stmt_list << stag_stmt(
|
251
|
-
<span class="ruby-comment cmt">#stmt_list.concat(
|
252
|
-
<span class="ruby-comment cmt">#stmt_list << etag_stmt(
|
257
|
+
<span class="ruby-comment cmt">#stmt_list << stag_stmt(elem_info) if is_foreach</span>
|
258
|
+
<span class="ruby-comment cmt">#stmt_list.concat(elem_info.cont_stmts)</span>
|
259
|
+
<span class="ruby-comment cmt">#stmt_list << etag_stmt(elem_info) if is_foreach</span>
|
253
260
|
<span class="ruby-comment cmt">#stmt_list << NativeStatement.new("}", :foreach)</span>
|
254
|
-
<span class="ruby-comment cmt">#stmt_list << etag_stmt(
|
261
|
+
<span class="ruby-comment cmt">#stmt_list << etag_stmt(elem_info) if !is_foreach</span>
|
255
262
|
|
256
263
|
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:while</span>
|
257
|
-
<span class="ruby-identifier">wrap_element_with_native_stmt</span>(<span class="ruby-identifier">
|
264
|
+
<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">"while (#{d_arg}) {"</span>, <span class="ruby-value str">"}"</span>, <span class="ruby-identifier">:while</span>)
|
258
265
|
<span class="ruby-comment cmt">#stmt_list << NativeStatement.new("while (#{d_arg}) {", :while)</span>
|
259
|
-
<span class="ruby-comment cmt">#stmt_list << stag_stmt(
|
266
|
+
<span class="ruby-comment cmt">#stmt_list << stag_stmt(elem_info)</span>
|
260
267
|
<span class="ruby-comment cmt">#stmt_list.concat(cont_stmts)</span>
|
261
|
-
<span class="ruby-comment cmt">#stmt_list << etag_stmt(
|
268
|
+
<span class="ruby-comment cmt">#stmt_list << etag_stmt(elem_info)</span>
|
262
269
|
<span class="ruby-comment cmt">#stmt_list << NativeStatement.new("}", :while)</span>
|
263
270
|
|
264
271
|
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:loop</span>
|
265
|
-
<span class="ruby-identifier">error_if_empty_tag</span>(<span class="ruby-identifier">
|
266
|
-
<span class="ruby-identifier">wrap_content_with_native_stmt</span>(<span class="ruby-identifier">
|
272
|
+
<span class="ruby-identifier">error_if_empty_tag</span>(<span class="ruby-identifier">elem_info</span>, <span class="ruby-identifier">d_str</span>)
|
273
|
+
<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">"while (#{d_arg}) {"</span>, <span class="ruby-value str">"}"</span>, <span class="ruby-identifier">:while</span>)
|
267
274
|
<span class="ruby-comment cmt">#stmt_list << stag_stmt</span>
|
268
275
|
<span class="ruby-comment cmt">#stmt_list << NativeStatement.new("while (#{d_arg}) {", :while)</span>
|
269
276
|
<span class="ruby-comment cmt">#stmt_list.concat(cont_stmts)</span>
|
@@ -271,14 +278,14 @@ directive handler for ePerl
|
|
271
278
|
<span class="ruby-comment cmt">#stmt_list << etag_stmt</span>
|
272
279
|
|
273
280
|
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:set</span>
|
274
|
-
<span class="ruby-identifier">wrap_element_with_native_stmt</span>(<span class="ruby-identifier">
|
281
|
+
<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">"#{d_arg};"</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">:set</span>)
|
275
282
|
<span class="ruby-comment cmt">#stmt_list << NativeStatement.new("#{d_arg};", :set)</span>
|
276
283
|
<span class="ruby-comment cmt">#stmt_list << stag_stmt</span>
|
277
284
|
<span class="ruby-comment cmt">#stmt_list.concat(cont_stmts)</span>
|
278
285
|
<span class="ruby-comment cmt">#stmt_list << etag_stmt</span>
|
279
286
|
|
280
287
|
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:if</span>
|
281
|
-
<span class="ruby-identifier">wrap_element_with_native_stmt</span>(<span class="ruby-identifier">
|
288
|
+
<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">"if (#{d_arg}) {"</span>, <span class="ruby-value str">"}"</span>, <span class="ruby-identifier">:if</span>)
|
282
289
|
<span class="ruby-comment cmt">#stmt_list << NativeStatement.new("if (#{d_arg}) {", :if)</span>
|
283
290
|
<span class="ruby-comment cmt">#stmt_list << stag_stmt</span>
|
284
291
|
<span class="ruby-comment cmt">#stmt_list.concat(cont_stmts)</span>
|
@@ -286,11 +293,11 @@ directive handler for ePerl
|
|
286
293
|
<span class="ruby-comment cmt">#stmt_list << NativeStatement.new("}", :if)</span>
|
287
294
|
|
288
295
|
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:elsif</span>, <span class="ruby-identifier">:else</span>
|
289
|
-
<span class="ruby-identifier">error_when_last_stmt_is_not_if</span>(<span class="ruby-identifier">
|
296
|
+
<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>)
|
290
297
|
<span class="ruby-identifier">stmt_list</span>.<span class="ruby-identifier">pop</span> <span class="ruby-comment cmt"># delete '}'</span>
|
291
298
|
<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>
|
292
299
|
<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">"} else {"</span> <span class="ruby-operator">:</span> <span class="ruby-node">"} elsif (#{d_arg}) {"</span>
|
293
|
-
<span class="ruby-identifier">wrap_element_with_native_stmt</span>(<span class="ruby-identifier">
|
300
|
+
<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">"}"</span>, <span class="ruby-identifier">kind</span>)
|
294
301
|
<span class="ruby-comment cmt">#stmt_list << NativeStatement.new(code, kind)</span>
|
295
302
|
<span class="ruby-comment cmt">#stmt_list << stag_stmt</span>
|
296
303
|
<span class="ruby-comment cmt">#stmt_list.concat(cont_stmts)</span>
|
@@ -298,19 +305,19 @@ directive handler for ePerl
|
|
298
305
|
<span class="ruby-comment cmt">#stmt_list << NativeStatement.new("}", kind)</span>
|
299
306
|
|
300
307
|
<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>
|
301
|
-
<span class="ruby-identifier">error_if_empty_tag</span>(<span class="ruby-identifier">
|
302
|
-
<span class="ruby-identifier">
|
308
|
+
<span class="ruby-identifier">error_if_empty_tag</span>(<span class="ruby-identifier">elem_info</span>, <span class="ruby-identifier">d_str</span>)
|
309
|
+
<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>
|
303
310
|
<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>)
|
304
|
-
<span class="ruby-identifier">add_native_expr_with_default</span>(<span class="ruby-identifier">
|
305
|
-
<span class="ruby-node">"if (#{
|
306
|
-
<span class="ruby-comment cmt">#stmt_list << stag_stmt(
|
311
|
+
<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>,
|
312
|
+
<span class="ruby-node">"if (#{expr_str}) {"</span>, <span class="ruby-value str">"} else {"</span>, <span class="ruby-value str">"}"</span>)
|
313
|
+
<span class="ruby-comment cmt">#stmt_list << stag_stmt(elem_info)</span>
|
307
314
|
<span class="ruby-comment cmt">#stmt_list << NativeStatement.new_without_newline("if (#{d_arg}) {", :if)</span>
|
308
315
|
<span class="ruby-comment cmt">#flag_escape = d_name == :default ? nil : (d_name == :Default)</span>
|
309
316
|
<span class="ruby-comment cmt">#stmt_list << PrintStatement.new([ NativeExpression.new(d_arg, flag_escape) ])</span>
|
310
317
|
<span class="ruby-comment cmt">#stmt_list << NativeStatement.new_without_newline("} else {", :else)</span>
|
311
|
-
<span class="ruby-comment cmt">#stmt_list.concat(
|
318
|
+
<span class="ruby-comment cmt">#stmt_list.concat(elem_info.cont_stmts)</span>
|
312
319
|
<span class="ruby-comment cmt">#stmt_list << NativeStatement.new_without_newline("}", :else)</span>
|
313
|
-
<span class="ruby-comment cmt">#stmt_list << etag_stmt(
|
320
|
+
<span class="ruby-comment cmt">#stmt_list << etag_stmt(elem_info)</span>
|
314
321
|
|
315
322
|
<span class="ruby-keyword kw">else</span>
|
316
323
|
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
|
@@ -324,21 +331,21 @@ directive handler for ePerl
|
|
324
331
|
</div>
|
325
332
|
</div>
|
326
333
|
|
327
|
-
<div id="method-
|
328
|
-
<a name="
|
334
|
+
<div id="method-M000113" class="method-detail">
|
335
|
+
<a name="M000113"></a>
|
329
336
|
|
330
337
|
<div class="method-heading">
|
331
|
-
<a href="#
|
338
|
+
<a href="#M000113" class="method-signature">
|
332
339
|
<span class="method-name">mapping_pattern</span><span class="method-args">()</span>
|
333
340
|
</a>
|
334
341
|
</div>
|
335
342
|
|
336
343
|
<div class="method-description">
|
337
344
|
<p><a class="source-toggle" href="#"
|
338
|
-
onclick="toggleCode('
|
339
|
-
<div class="method-source-code" id="
|
345
|
+
onclick="toggleCode('M000113-source');return false;">[Source]</a></p>
|
346
|
+
<div class="method-source-code" id="M000113-source">
|
340
347
|
<pre>
|
341
|
-
<span class="ruby-comment cmt"># File kwartz/binding/eperl.rb, line
|
348
|
+
<span class="ruby-comment cmt"># File kwartz/binding/eperl.rb, line 71</span>
|
342
349
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mapping_pattern</span>
|
343
350
|
<span class="ruby-keyword kw">return</span> <span class="ruby-constant">PERL_MAPPING_PATTERN</span>
|
344
351
|
<span class="ruby-keyword kw">end</span>
|
@@ -94,7 +94,7 @@ translator for ePerl
|
|
94
94
|
<h3 class="section-bar">Methods</h3>
|
95
95
|
|
96
96
|
<div class="name-list">
|
97
|
-
<a href="#
|
97
|
+
<a href="#M000124">new</a>
|
98
98
|
</div>
|
99
99
|
</div>
|
100
100
|
|
@@ -102,6 +102,13 @@ translator for ePerl
|
|
102
102
|
|
103
103
|
|
104
104
|
<!-- if includes -->
|
105
|
+
<div id="includes">
|
106
|
+
<h3 class="section-bar">Included Modules</h3>
|
107
|
+
|
108
|
+
<div id="includes-list">
|
109
|
+
<span class="include-name"><a href="EperlExpressionParser.html">EperlExpressionParser</a></span>
|
110
|
+
</div>
|
111
|
+
</div>
|
105
112
|
|
106
113
|
<div id="section">
|
107
114
|
|
@@ -129,21 +136,21 @@ translator for ePerl
|
|
129
136
|
<div id="methods">
|
130
137
|
<h3 class="section-bar">Public Class methods</h3>
|
131
138
|
|
132
|
-
<div id="method-
|
133
|
-
<a name="
|
139
|
+
<div id="method-M000124" class="method-detail">
|
140
|
+
<a name="M000124"></a>
|
134
141
|
|
135
142
|
<div class="method-heading">
|
136
|
-
<a href="#
|
143
|
+
<a href="#M000124" class="method-signature">
|
137
144
|
<span class="method-name">new</span><span class="method-args">(properties={})</span>
|
138
145
|
</a>
|
139
146
|
</div>
|
140
147
|
|
141
148
|
<div class="method-description">
|
142
149
|
<p><a class="source-toggle" href="#"
|
143
|
-
onclick="toggleCode('
|
144
|
-
<div class="method-source-code" id="
|
150
|
+
onclick="toggleCode('M000124-source');return false;">[Source]</a></p>
|
151
|
+
<div class="method-source-code" id="M000124-source">
|
145
152
|
<pre>
|
146
|
-
<span class="ruby-comment cmt"># File kwartz/binding/eperl.rb, line
|
153
|
+
<span class="ruby-comment cmt"># File kwartz/binding/eperl.rb, line 220</span>
|
147
154
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">properties</span>={})
|
148
155
|
<span class="ruby-keyword kw">super</span>(<span class="ruby-constant">EPERL_EMBED_PATTERNS</span>, <span class="ruby-identifier">properties</span>)
|
149
156
|
<span class="ruby-keyword kw">end</span>
|