kwartz 3.1.2 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -94,7 +94,7 @@ translator for rails
|
|
94
94
|
<h3 class="section-bar">Methods</h3>
|
95
95
|
|
96
96
|
<div class="name-list">
|
97
|
-
<a href="#
|
97
|
+
<a href="#M000194">new</a>
|
98
98
|
</div>
|
99
99
|
</div>
|
100
100
|
|
@@ -102,6 +102,13 @@ translator for rails
|
|
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="RubyExpressionParser.html">RubyExpressionParser</a></span>
|
110
|
+
</div>
|
111
|
+
</div>
|
105
112
|
|
106
113
|
<div id="section">
|
107
114
|
|
@@ -129,19 +136,19 @@ translator for rails
|
|
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-M000194" class="method-detail">
|
140
|
+
<a name="M000194"></a>
|
134
141
|
|
135
142
|
<div class="method-heading">
|
136
|
-
<a href="#
|
143
|
+
<a href="#M000194" 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('M000194-source');return false;">[Source]</a></p>
|
151
|
+
<div class="method-source-code" id="M000194-source">
|
145
152
|
<pre>
|
146
153
|
<span class="ruby-comment cmt"># File kwartz/binding/rails.rb, line 288</span>
|
147
154
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">properties</span>={})
|
@@ -0,0 +1,180 @@
|
|
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::RubyExpressionParser</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::RubyExpressionParser</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/kwartz/binding/ruby_rb.html">
|
59
|
+
kwartz/binding/ruby.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="#M000058">parse_expr_str</a>
|
84
|
+
<a href="#M000059">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-M000058" class="method-detail">
|
107
|
+
<a name="M000058"></a>
|
108
|
+
|
109
|
+
<div class="method-heading">
|
110
|
+
<a href="#M000058" 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('M000058-source');return false;">[Source]</a></p>
|
118
|
+
<div class="method-source-code" id="M000058-source">
|
119
|
+
<pre>
|
120
|
+
<span class="ruby-comment cmt"># File kwartz/binding/ruby.rb, line 18</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-identifier">expr_str</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-identifier">expr_str</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">expr</span> = <span class="ruby-identifier">expr_str</span>
|
129
|
+
<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>
|
130
|
+
<span class="ruby-identifier">expr</span> = <span class="ruby-identifier">expr_str</span>
|
131
|
+
<span class="ruby-keyword kw">else</span>
|
132
|
+
<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>)
|
133
|
+
<span class="ruby-keyword kw">end</span>
|
134
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">expr</span>
|
135
|
+
<span class="ruby-keyword kw">end</span>
|
136
|
+
</pre>
|
137
|
+
</div>
|
138
|
+
</div>
|
139
|
+
</div>
|
140
|
+
|
141
|
+
<div id="method-M000059" class="method-detail">
|
142
|
+
<a name="M000059"></a>
|
143
|
+
|
144
|
+
<div class="method-heading">
|
145
|
+
<a href="#M000059" class="method-signature">
|
146
|
+
<span class="method-name">parse_expr_str!</span><span class="method-args">(expr_str)</span>
|
147
|
+
</a>
|
148
|
+
</div>
|
149
|
+
|
150
|
+
<div class="method-description">
|
151
|
+
<p><a class="source-toggle" href="#"
|
152
|
+
onclick="toggleCode('M000059-source');return false;">[Source]</a></p>
|
153
|
+
<div class="method-source-code" id="M000059-source">
|
154
|
+
<pre>
|
155
|
+
<span class="ruby-comment cmt"># File kwartz/binding/ruby.rb, line 35</span>
|
156
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse_expr_str!</span>(<span class="ruby-identifier">expr_str</span>)
|
157
|
+
<span class="ruby-keyword kw">begin</span>
|
158
|
+
<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>)
|
159
|
+
<span class="ruby-keyword kw">rescue</span>
|
160
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">expr_str</span>
|
161
|
+
<span class="ruby-keyword kw">end</span>
|
162
|
+
<span class="ruby-keyword kw">end</span>
|
163
|
+
</pre>
|
164
|
+
</div>
|
165
|
+
</div>
|
166
|
+
</div>
|
167
|
+
|
168
|
+
|
169
|
+
</div>
|
170
|
+
|
171
|
+
|
172
|
+
</div>
|
173
|
+
|
174
|
+
|
175
|
+
<div id="validator-badges">
|
176
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
177
|
+
</div>
|
178
|
+
|
179
|
+
</body>
|
180
|
+
</html>
|
@@ -94,10 +94,10 @@ directive handler for Ruby
|
|
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="#M000180">directive_format</a>
|
98
|
+
<a href="#M000178">directive_pattern</a>
|
99
|
+
<a href="#M000181">handle</a>
|
100
|
+
<a href="#M000179">mapping_pattern</a>
|
101
101
|
</div>
|
102
102
|
</div>
|
103
103
|
|
@@ -105,6 +105,13 @@ directive handler for Ruby
|
|
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="RubyExpressionParser.html">RubyExpressionParser</a></span>
|
113
|
+
</div>
|
114
|
+
</div>
|
108
115
|
|
109
116
|
<div id="section">
|
110
117
|
|
@@ -142,21 +149,21 @@ directive handler for Ruby
|
|
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-M000180" class="method-detail">
|
153
|
+
<a name="M000180"></a>
|
147
154
|
|
148
155
|
<div class="method-heading">
|
149
|
-
<a href="#
|
156
|
+
<a href="#M000180" 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('M000180-source');return false;">[Source]</a></p>
|
164
|
+
<div class="method-source-code" id="M000180-source">
|
158
165
|
<pre>
|
159
|
-
<span class="ruby-comment cmt"># File kwartz/binding/ruby.rb, line
|
166
|
+
<span class="ruby-comment cmt"># File kwartz/binding/ruby.rb, line 72</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">RUBY_DIRECTIVE_FORMAT</span>
|
162
169
|
<span class="ruby-keyword kw">end</span>
|
@@ -165,21 +172,21 @@ directive handler for Ruby
|
|
165
172
|
</div>
|
166
173
|
</div>
|
167
174
|
|
168
|
-
<div id="method-
|
169
|
-
<a name="
|
175
|
+
<div id="method-M000178" class="method-detail">
|
176
|
+
<a name="M000178"></a>
|
170
177
|
|
171
178
|
<div class="method-heading">
|
172
|
-
<a href="#
|
179
|
+
<a href="#M000178" 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('M000178-source');return false;">[Source]</a></p>
|
187
|
+
<div class="method-source-code" id="M000178-source">
|
181
188
|
<pre>
|
182
|
-
<span class="ruby-comment cmt"># File kwartz/binding/ruby.rb, line
|
189
|
+
<span class="ruby-comment cmt"># File kwartz/binding/ruby.rb, line 58</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">RUBY_DIRECTIVE_PATTERN</span>
|
185
192
|
<span class="ruby-keyword kw">end</span>
|
@@ -188,39 +195,36 @@ directive handler for Ruby
|
|
188
195
|
</div>
|
189
196
|
</div>
|
190
197
|
|
191
|
-
<div id="method-
|
192
|
-
<a name="
|
198
|
+
<div id="method-M000181" class="method-detail">
|
199
|
+
<a name="M000181"></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="#M000181" 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('M000181-source');return false;">[Source]</a></p>
|
210
|
+
<div class="method-source-code" id="M000181-source">
|
204
211
|
<pre>
|
205
|
-
<span class="ruby-comment cmt"># File kwartz/binding/ruby.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/ruby.rb, line 77</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">
|
214
|
-
<span class="ruby-comment cmt">#stag_info = arg.stag_info</span>
|
215
|
-
<span class="ruby-comment cmt">#etag_info = arg.etag_info</span>
|
216
|
-
<span class="ruby-comment cmt">#cont_stmts = arg.cont_stmts</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>
|
217
221
|
|
218
222
|
<span class="ruby-keyword kw">case</span> <span class="ruby-identifier">d_name</span>
|
219
223
|
|
220
224
|
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:for</span>, <span class="ruby-identifier">:For</span>, <span class="ruby-identifier">:FOR</span>, <span class="ruby-identifier">:list</span>, <span class="ruby-identifier">:List</span>, <span class="ruby-identifier">:LIST</span>
|
221
225
|
<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> \
|
222
226
|
<span class="ruby-operator">||</span> <span class="ruby-identifier">d_arg</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/\A(\w+)(?:,(\w+))?\s*[:=]\s*(.*)\z/</span>
|
223
|
-
<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">
|
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>)
|
224
228
|
<span class="ruby-keyword kw">end</span>
|
225
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>
|
226
230
|
<span class="ruby-identifier">is_foreach</span> = <span class="ruby-identifier">d_name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:for</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">d_name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:For</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">d_name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:FOR</span>
|
@@ -234,70 +238,70 @@ directive handler for Ruby
|
|
234
238
|
<span class="ruby-identifier">code</span> <span class="ruby-operator"><<</span> <span class="ruby-node">" #{counter} += 1"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">counter</span>
|
235
239
|
<span class="ruby-identifier">code</span> <span class="ruby-operator"><<</span> <span class="ruby-node">" #{toggle} = #{counter}%2==0 ? #{@even} : #{@odd}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">toggle</span>
|
236
240
|
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">is_foreach</span>
|
237
|
-
<span class="ruby-identifier">wrap_element_with_native_stmt</span>(<span class="ruby-identifier">
|
241
|
+
<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">"end"</span>, <span class="ruby-identifier">:foreach</span>)
|
238
242
|
<span class="ruby-keyword kw">else</span>
|
239
|
-
<span class="ruby-identifier">wrap_content_with_native_stmt</span>(<span class="ruby-identifier">
|
243
|
+
<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">"end"</span>, <span class="ruby-identifier">:foreach</span>)
|
240
244
|
<span class="ruby-keyword kw">end</span>
|
241
245
|
|
242
246
|
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:while</span>
|
243
|
-
<span class="ruby-identifier">wrap_element_with_native_stmt</span>(<span class="ruby-identifier">
|
247
|
+
<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} do"</span>, <span class="ruby-value str">"end"</span>, <span class="ruby-identifier">:while</span>)
|
244
248
|
<span class="ruby-comment cmt">#stmt_list << NativeStatement.new("while #{d_arg} do", :while)</span>
|
245
|
-
<span class="ruby-comment cmt">#stmt_list << stag_stmt(
|
246
|
-
<span class="ruby-comment cmt">#stmt_list.concat(
|
247
|
-
<span class="ruby-comment cmt">#stmt_list << etag_stmt(
|
249
|
+
<span class="ruby-comment cmt">#stmt_list << stag_stmt(elem_info)</span>
|
250
|
+
<span class="ruby-comment cmt">#stmt_list.concat(e.cont_stmts)</span>
|
251
|
+
<span class="ruby-comment cmt">#stmt_list << etag_stmt(elem_info)</span>
|
248
252
|
<span class="ruby-comment cmt">#stmt_list << NativeStatement.new("end", :while)</span>
|
249
253
|
|
250
254
|
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:loop</span>
|
251
|
-
<span class="ruby-identifier">error_if_empty_tag</span>(<span class="ruby-identifier">
|
252
|
-
<span class="ruby-identifier">wrap_content_with_native_stmt</span>(<span class="ruby-identifier">
|
253
|
-
<span class="ruby-comment cmt">#stmt_list << stag_stmt(
|
255
|
+
<span class="ruby-identifier">error_if_empty_tag</span>(<span class="ruby-identifier">elem_info</span>, <span class="ruby-identifier">d_str</span>)
|
256
|
+
<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} do"</span>, <span class="ruby-value str">"end"</span>, <span class="ruby-identifier">:while</span>)
|
257
|
+
<span class="ruby-comment cmt">#stmt_list << stag_stmt(elem_info)</span>
|
254
258
|
<span class="ruby-comment cmt">#stmt_list << NativeStatement.new("while #{d_arg} do", :while)</span>
|
255
|
-
<span class="ruby-comment cmt">#stmt_list.concat(
|
259
|
+
<span class="ruby-comment cmt">#stmt_list.concat(e.cont_stmts)</span>
|
256
260
|
<span class="ruby-comment cmt">#stmt_list << NativeStatement.new("end", :while)</span>
|
257
|
-
<span class="ruby-comment cmt">#stmt_list << etag_stmt(
|
261
|
+
<span class="ruby-comment cmt">#stmt_list << etag_stmt(elem_info)</span>
|
258
262
|
|
259
263
|
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:set</span>
|
260
|
-
<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-identifier">d_arg</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">:set</span>)
|
261
265
|
<span class="ruby-comment cmt">#stmt_list << NativeStatement.new(d_arg, :set)</span>
|
262
|
-
<span class="ruby-comment cmt">#stmt_list << stag_stmt(
|
263
|
-
<span class="ruby-comment cmt">#stmt_list.concat(
|
264
|
-
<span class="ruby-comment cmt">#stmt_list << etag_stmt(
|
266
|
+
<span class="ruby-comment cmt">#stmt_list << stag_stmt(elem_info)</span>
|
267
|
+
<span class="ruby-comment cmt">#stmt_list.concat(e.cont_stmts)</span>
|
268
|
+
<span class="ruby-comment cmt">#stmt_list << etag_stmt(elem_info)</span>
|
265
269
|
|
266
270
|
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:if</span>
|
267
|
-
<span class="ruby-identifier">wrap_element_with_native_stmt</span>(<span class="ruby-identifier">
|
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">"if #{d_arg} then"</span>, <span class="ruby-value str">"end"</span>, <span class="ruby-identifier">:if</span>)
|
268
272
|
<span class="ruby-comment cmt">#stmt_list << NativeStatement.new("if #{d_arg} then", :if)</span>
|
269
|
-
<span class="ruby-comment cmt">#stmt_list << stag_stmt(
|
270
|
-
<span class="ruby-comment cmt">#stmt_list.concat(
|
271
|
-
<span class="ruby-comment cmt">#stmt_list << etag_stmt(
|
273
|
+
<span class="ruby-comment cmt">#stmt_list << stag_stmt(elem_info)</span>
|
274
|
+
<span class="ruby-comment cmt">#stmt_list.concat(e.cont_stmts)</span>
|
275
|
+
<span class="ruby-comment cmt">#stmt_list << etag_stmt(elem_info)</span>
|
272
276
|
<span class="ruby-comment cmt">#stmt_list << NativeStatement.new("end", :if)</span>
|
273
277
|
|
274
278
|
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:elsif</span>, <span class="ruby-identifier">:else</span>
|
275
|
-
<span class="ruby-identifier">error_when_last_stmt_is_not_if</span>(<span class="ruby-identifier">
|
279
|
+
<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>)
|
276
280
|
<span class="ruby-identifier">stmt_list</span>.<span class="ruby-identifier">pop</span> <span class="ruby-comment cmt"># delete 'end'</span>
|
277
281
|
<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>
|
278
282
|
<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} then"</span>
|
279
|
-
<span class="ruby-identifier">wrap_element_with_native_stmt</span>(<span class="ruby-identifier">
|
283
|
+
<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">"end"</span>, <span class="ruby-identifier">kind</span>)
|
280
284
|
<span class="ruby-comment cmt">#stmt_list << NativeStatement.new(code, kind)</span>
|
281
|
-
<span class="ruby-comment cmt">#stmt_list << stag_stmt(
|
282
|
-
<span class="ruby-comment cmt">#stmt_list.concat(
|
283
|
-
<span class="ruby-comment cmt">#stmt_list << etag_stmt(
|
285
|
+
<span class="ruby-comment cmt">#stmt_list << stag_stmt(elem_info)</span>
|
286
|
+
<span class="ruby-comment cmt">#stmt_list.concat(e.cont_stmts)</span>
|
287
|
+
<span class="ruby-comment cmt">#stmt_list << etag_stmt(elem_info)</span>
|
284
288
|
<span class="ruby-comment cmt">#stmt_list << NativeStatement.new("end", kind)</span>
|
285
289
|
|
286
290
|
<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>
|
287
|
-
<span class="ruby-identifier">error_if_empty_tag</span>(<span class="ruby-identifier">
|
288
|
-
<span class="ruby-identifier">
|
291
|
+
<span class="ruby-identifier">error_if_empty_tag</span>(<span class="ruby-identifier">elem_info</span>, <span class="ruby-identifier">d_str</span>)
|
292
|
+
<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>
|
289
293
|
<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>)
|
290
|
-
<span class="ruby-identifier">add_native_expr_with_default</span>(<span class="ruby-identifier">
|
291
|
-
<span class="ruby-node">"if (#{
|
294
|
+
<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>,
|
295
|
+
<span class="ruby-node">"if (#{expr_str}) && !(#{d_arg}).to_s.empty? then"</span>,
|
292
296
|
<span class="ruby-value str">"else"</span>, <span class="ruby-value str">"end"</span>)
|
293
|
-
<span class="ruby-comment cmt">#stmt_list << stag_stmt(
|
297
|
+
<span class="ruby-comment cmt">#stmt_list << stag_stmt(elem_info)</span>
|
294
298
|
<span class="ruby-comment cmt">#stmt_list << NativeStatement.new_without_newline("if (#{d_arg}) && !(#{d_arg}).to_s.empty? then", :if)</span>
|
295
299
|
<span class="ruby-comment cmt">#flag_escape = d_name == :default ? nil : (d_name == :Default)</span>
|
296
300
|
<span class="ruby-comment cmt">#stmt_list << PrintStatement.new([ NativeExpression.new(d_arg, flag_escape) ])</span>
|
297
301
|
<span class="ruby-comment cmt">#stmt_list << NativeStatement.new_without_newline("else", :else)</span>
|
298
|
-
<span class="ruby-comment cmt">#stmt_list.concat(
|
302
|
+
<span class="ruby-comment cmt">#stmt_list.concat(e.cont_stmts)</span>
|
299
303
|
<span class="ruby-comment cmt">#stmt_list << NativeStatement.new_without_newline("end", :else)</span>
|
300
|
-
<span class="ruby-comment cmt">#stmt_list << etag_stmt(
|
304
|
+
<span class="ruby-comment cmt">#stmt_list << etag_stmt(elem_info)</span>
|
301
305
|
|
302
306
|
<span class="ruby-keyword kw">else</span>
|
303
307
|
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
|
@@ -311,21 +315,21 @@ directive handler for Ruby
|
|
311
315
|
</div>
|
312
316
|
</div>
|
313
317
|
|
314
|
-
<div id="method-
|
315
|
-
<a name="
|
318
|
+
<div id="method-M000179" class="method-detail">
|
319
|
+
<a name="M000179"></a>
|
316
320
|
|
317
321
|
<div class="method-heading">
|
318
|
-
<a href="#
|
322
|
+
<a href="#M000179" class="method-signature">
|
319
323
|
<span class="method-name">mapping_pattern</span><span class="method-args">()</span>
|
320
324
|
</a>
|
321
325
|
</div>
|
322
326
|
|
323
327
|
<div class="method-description">
|
324
328
|
<p><a class="source-toggle" href="#"
|
325
|
-
onclick="toggleCode('
|
326
|
-
<div class="method-source-code" id="
|
329
|
+
onclick="toggleCode('M000179-source');return false;">[Source]</a></p>
|
330
|
+
<div class="method-source-code" id="M000179-source">
|
327
331
|
<pre>
|
328
|
-
<span class="ruby-comment cmt"># File kwartz/binding/ruby.rb, line
|
332
|
+
<span class="ruby-comment cmt"># File kwartz/binding/ruby.rb, line 65</span>
|
329
333
|
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mapping_pattern</span>
|
330
334
|
<span class="ruby-keyword kw">return</span> <span class="ruby-constant">RUBY_MAPPING_PATTERN</span>
|
331
335
|
<span class="ruby-keyword kw">end</span>
|