kwartz 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +340 -0
- data/ChangeLog +103 -0
- data/README.txt +37 -0
- data/bin/kwartz +12 -0
- data/doc-api/classes/Kwartz.html +218 -0
- data/doc-api/classes/Kwartz/Assertion.html +140 -0
- data/doc-api/classes/Kwartz/AssertionError.html +148 -0
- data/doc-api/classes/Kwartz/AttrInfo.html +320 -0
- data/doc-api/classes/Kwartz/BaseError.html +206 -0
- data/doc-api/classes/Kwartz/BaseTranslator.html +331 -0
- data/doc-api/classes/Kwartz/CharacterType.html +212 -0
- data/doc-api/classes/Kwartz/CommandOptionError.html +154 -0
- data/doc-api/classes/Kwartz/CommandOptions.html +374 -0
- data/doc-api/classes/Kwartz/Config.html +150 -0
- data/doc-api/classes/Kwartz/ConvertError.html +191 -0
- data/doc-api/classes/Kwartz/Converter.html +252 -0
- data/doc-api/classes/Kwartz/CssStyleParser.html +483 -0
- data/doc-api/classes/Kwartz/DocumentRuleset.html +369 -0
- data/doc-api/classes/Kwartz/ElementExpander.html +325 -0
- data/doc-api/classes/Kwartz/ElementInfo.html +312 -0
- data/doc-api/classes/Kwartz/ElementRuleset.html +582 -0
- data/doc-api/classes/Kwartz/EperlHandler.html +338 -0
- data/doc-api/classes/Kwartz/EperlTranslator.html +167 -0
- data/doc-api/classes/Kwartz/ErubisHandler.html +113 -0
- data/doc-api/classes/Kwartz/ErubisTranslator.html +168 -0
- data/doc-api/classes/Kwartz/ErubyHandler.html +337 -0
- data/doc-api/classes/Kwartz/ErubyTranslator.html +167 -0
- data/doc-api/classes/Kwartz/ExpandStatement.html +227 -0
- data/doc-api/classes/Kwartz/Expression.html +119 -0
- data/doc-api/classes/Kwartz/Handler.html +558 -0
- data/doc-api/classes/Kwartz/JstlHandler.html +657 -0
- data/doc-api/classes/Kwartz/JstlTranslator.html +226 -0
- data/doc-api/classes/Kwartz/KwartzError.html +146 -0
- data/doc-api/classes/Kwartz/Main.html +384 -0
- data/doc-api/classes/Kwartz/NativeExpression.html +236 -0
- data/doc-api/classes/Kwartz/NativeStatement.html +254 -0
- data/doc-api/classes/Kwartz/Node.html +156 -0
- data/doc-api/classes/Kwartz/ParseError.html +148 -0
- data/doc-api/classes/Kwartz/PhpHandler.html +333 -0
- data/doc-api/classes/Kwartz/PhpTranslator.html +194 -0
- data/doc-api/classes/Kwartz/PresentationLogicParser.html +830 -0
- data/doc-api/classes/Kwartz/PrintStatement.html +221 -0
- data/doc-api/classes/Kwartz/RailsHandler.html +587 -0
- data/doc-api/classes/Kwartz/RailsTranslator.html +167 -0
- data/doc-api/classes/Kwartz/RubyStyleParser.html +558 -0
- data/doc-api/classes/Kwartz/Ruleset.html +117 -0
- data/doc-api/classes/Kwartz/Statement.html +119 -0
- data/doc-api/classes/Kwartz/StrutsTranslator.html +190 -0
- data/doc-api/classes/Kwartz/TagInfo.html +314 -0
- data/doc-api/classes/Kwartz/TextConverter.html +270 -0
- data/doc-api/classes/Kwartz/Translator.html +318 -0
- data/doc-api/classes/Test.html +107 -0
- data/doc-api/classes/Test/Unit.html +101 -0
- data/doc-api/created.rid +1 -0
- data/doc-api/files/__/README_txt.html +150 -0
- data/doc-api/files/kwartz/assert_rb.html +114 -0
- data/doc-api/files/kwartz/binding/eperl_rb.html +116 -0
- data/doc-api/files/kwartz/binding/erubis_rb.html +116 -0
- data/doc-api/files/kwartz/binding/eruby_rb.html +115 -0
- data/doc-api/files/kwartz/binding/jstl_rb.html +116 -0
- data/doc-api/files/kwartz/binding/php_rb.html +116 -0
- data/doc-api/files/kwartz/binding/rails_rb.html +115 -0
- data/doc-api/files/kwartz/binding/struts_rb.html +117 -0
- data/doc-api/files/kwartz/config_rb.html +107 -0
- data/doc-api/files/kwartz/converter_rb.html +119 -0
- data/doc-api/files/kwartz/error_rb.html +107 -0
- data/doc-api/files/kwartz/main_rb.html +124 -0
- data/doc-api/files/kwartz/node_rb.html +114 -0
- data/doc-api/files/kwartz/parser_rb.html +117 -0
- data/doc-api/files/kwartz/translator_rb.html +115 -0
- data/doc-api/files/kwartz/util/assert-text-equal_rb.html +115 -0
- data/doc-api/files/kwartz/util/testcase-helper_rb.html +115 -0
- data/doc-api/files/kwartz_rb.html +120 -0
- data/doc-api/fr_class_index.html +75 -0
- data/doc-api/fr_file_index.html +45 -0
- data/doc-api/fr_method_index.html +216 -0
- data/doc-api/index.html +24 -0
- data/doc-api/rdoc-style.css +208 -0
- data/doc/docstyle.css +188 -0
- data/doc/p-pattern.html +1207 -0
- data/doc/reference.html +3396 -0
- data/doc/users-guide.html +1670 -0
- data/examples/breadcrumbs1/Makefile +15 -0
- data/examples/breadcrumbs1/breadcrumbs.eruby.plogic +27 -0
- data/examples/breadcrumbs1/breadcrumbs.html +12 -0
- data/examples/breadcrumbs1/breadcrumbs.jstl.plogic +28 -0
- data/examples/breadcrumbs1/breadcrumbs.php.plogic +26 -0
- data/examples/breadcrumbs1/main.php +12 -0
- data/examples/breadcrumbs1/main.rb +12 -0
- data/examples/breadcrumbs2/Makefile +15 -0
- data/examples/breadcrumbs2/breadcrumbs.eruby.plogic +22 -0
- data/examples/breadcrumbs2/breadcrumbs.html +14 -0
- data/examples/breadcrumbs2/breadcrumbs.jstl.plogic +24 -0
- data/examples/breadcrumbs2/breadcrumbs.php.plogic +23 -0
- data/examples/breadcrumbs2/main.php +12 -0
- data/examples/breadcrumbs2/main.rb +12 -0
- data/examples/pagelayout/Makefile +47 -0
- data/examples/pagelayout/content.eruby.plogic +44 -0
- data/examples/pagelayout/content.jstl.plogic +36 -0
- data/examples/pagelayout/content.php.plogic +37 -0
- data/examples/pagelayout/content1.html +36 -0
- data/examples/pagelayout/content2.html +29 -0
- data/examples/pagelayout/design.css +40 -0
- data/examples/pagelayout/layout.html +50 -0
- data/examples/pagelayout/main.php +55 -0
- data/examples/pagelayout/main.rb +77 -0
- data/examples/pagelayout/menu.eruby.plogic +14 -0
- data/examples/pagelayout/menu.html +13 -0
- data/examples/pagelayout/menu.jstl.plogic +14 -0
- data/examples/pagelayout/menu.php.plogic +14 -0
- data/examples/rails1/Makefile +36 -0
- data/examples/rails1/README +19 -0
- data/examples/rails1/application_helper.rb +31 -0
- data/examples/rails1/edit.html +28 -0
- data/examples/rails1/edit.plogic +10 -0
- data/examples/rails1/form.html +52 -0
- data/examples/rails1/form.plogic +33 -0
- data/examples/rails1/layout.plogic +15 -0
- data/examples/rails1/link_to.plogic +19 -0
- data/examples/rails1/list.html +48 -0
- data/examples/rails1/list.plogic +28 -0
- data/examples/rails1/new.html +27 -0
- data/examples/rails1/new.plogic +10 -0
- data/examples/rails1/reader.plogic +29 -0
- data/examples/rails1/show.html +40 -0
- data/examples/rails1/show.plogic +4 -0
- data/examples/rails1/writer.plogic +8 -0
- data/examples/table1/Makefile +15 -0
- data/examples/table1/main.php +11 -0
- data/examples/table1/main.rb +11 -0
- data/examples/table1/table1.eruby.plogic +21 -0
- data/examples/table1/table1.html +16 -0
- data/examples/table1/table1.jstl.plogic +21 -0
- data/examples/table1/table1.php.plogic +22 -0
- data/kwartz.gemspec +55 -0
- data/lib/kwartz.rb +13 -0
- data/lib/kwartz/assert.rb +31 -0
- data/lib/kwartz/binding/eperl.rb +166 -0
- data/lib/kwartz/binding/erubis.rb +61 -0
- data/lib/kwartz/binding/eruby.rb +164 -0
- data/lib/kwartz/binding/jstl.rb +334 -0
- data/lib/kwartz/binding/php.rb +167 -0
- data/lib/kwartz/binding/rails.rb +295 -0
- data/lib/kwartz/binding/struts.rb +109 -0
- data/lib/kwartz/config.rb +28 -0
- data/lib/kwartz/converter.rb +920 -0
- data/lib/kwartz/error.rb +41 -0
- data/lib/kwartz/main.rb +464 -0
- data/lib/kwartz/node.rb +454 -0
- data/lib/kwartz/parser.rb +903 -0
- data/lib/kwartz/translator.rb +153 -0
- data/lib/kwartz/util/assert-text-equal.rb +44 -0
- data/lib/kwartz/util/testcase-helper.rb +112 -0
- data/setup.rb +1331 -0
- data/test/test-compile.rb +36 -0
- data/test/test-compile.yaml +178 -0
- data/test/test-converter.rb +34 -0
- data/test/test-converter.yaml +127 -0
- data/test/test-directives.rb +32 -0
- data/test/test-directives.yaml +1411 -0
- data/test/test-main.rb +464 -0
- data/test/test-parser.rb +54 -0
- data/test/test-parser.yaml +394 -0
- data/test/test-rails.rb +28 -0
- data/test/test-rails.yaml +301 -0
- data/test/test-ruleset.rb +36 -0
- data/test/test-ruleset.yaml +804 -0
- data/test/test.rb +44 -0
- metadata +236 -0
@@ -0,0 +1,483 @@
|
|
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::CssStyleParser</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::CssStyleParser</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/kwartz/parser_rb.html">
|
59
|
+
kwartz/parser.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="PresentationLogicParser.html">
|
69
|
+
PresentationLogicParser
|
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
|
+
css style presentation logic parser
|
86
|
+
</p>
|
87
|
+
<p>
|
88
|
+
example of presentation logic in css style:
|
89
|
+
</p>
|
90
|
+
<pre>
|
91
|
+
// comment
|
92
|
+
#list {
|
93
|
+
value: @var;
|
94
|
+
attrs: "class" @classname, "bgcolro" color;
|
95
|
+
append: @value==item['list'] ? ' checked' : '';
|
96
|
+
logic: {
|
97
|
+
@list.each { |item|
|
98
|
+
_stag
|
99
|
+
_cont
|
100
|
+
_etag
|
101
|
+
}
|
102
|
+
}
|
103
|
+
}
|
104
|
+
</pre>
|
105
|
+
|
106
|
+
</div>
|
107
|
+
|
108
|
+
|
109
|
+
</div>
|
110
|
+
|
111
|
+
<div id="method-list">
|
112
|
+
<h3 class="section-bar">Methods</h3>
|
113
|
+
|
114
|
+
<div class="name-list">
|
115
|
+
<a href="#M000042">has_colon?</a>
|
116
|
+
<a href="#M000040">keywords</a>
|
117
|
+
<a href="#M000038">parse</a>
|
118
|
+
<a href="#M000041">parse_document_ruleset</a>
|
119
|
+
<a href="#M000043">parse_element_ruleset</a>
|
120
|
+
<a href="#M000044">parse_import_command</a>
|
121
|
+
<a href="#M000039">scan_hook</a>
|
122
|
+
</div>
|
123
|
+
</div>
|
124
|
+
|
125
|
+
</div>
|
126
|
+
|
127
|
+
|
128
|
+
<!-- if includes -->
|
129
|
+
|
130
|
+
<div id="section">
|
131
|
+
|
132
|
+
|
133
|
+
<div id="constants-list">
|
134
|
+
<h3 class="section-bar">Constants</h3>
|
135
|
+
|
136
|
+
<div class="name-list">
|
137
|
+
<table summary="Constants">
|
138
|
+
<tr class="top-aligned-row context-row">
|
139
|
+
<td class="context-item-name">CSSSTYLE_KEYWORDS</td>
|
140
|
+
<td>=</td>
|
141
|
+
<td class="context-item-value">{ 'begin'=>:begin, 'end'=>:end }</td>
|
142
|
+
</tr>
|
143
|
+
</table>
|
144
|
+
</div>
|
145
|
+
</div>
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
<!-- if method_list -->
|
153
|
+
<div id="methods">
|
154
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
155
|
+
|
156
|
+
<div id="method-M000038" class="method-detail">
|
157
|
+
<a name="M000038"></a>
|
158
|
+
|
159
|
+
<div class="method-heading">
|
160
|
+
<a href="#M000038" class="method-signature">
|
161
|
+
<span class="method-name">parse</span><span class="method-args">(input, filename='')</span>
|
162
|
+
</a>
|
163
|
+
</div>
|
164
|
+
|
165
|
+
<div class="method-description">
|
166
|
+
<p><a class="source-toggle" href="#"
|
167
|
+
onclick="toggleCode('M000038-source');return false;">[Source]</a></p>
|
168
|
+
<div class="method-source-code" id="M000038-source">
|
169
|
+
<pre>
|
170
|
+
<span class="ruby-comment cmt"># File kwartz/parser.rb, line 595</span>
|
171
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse</span>(<span class="ruby-identifier">input</span>, <span class="ruby-identifier">filename</span>=<span class="ruby-value str">''</span>)
|
172
|
+
<span class="ruby-identifier">reset</span>(<span class="ruby-identifier">input</span>, <span class="ruby-identifier">filename</span>)
|
173
|
+
<span class="ruby-identifier">scan</span>()
|
174
|
+
<span class="ruby-identifier">rulesets</span> = []
|
175
|
+
<span class="ruby-keyword kw">while</span> <span class="ruby-ivar">@token</span> <span class="ruby-operator">==</span> <span class="ruby-value">?@</span>
|
176
|
+
<span class="ruby-identifier">c</span> = <span class="ruby-identifier">getch</span>();
|
177
|
+
<span class="ruby-identifier">scan_ident</span>()
|
178
|
+
<span class="ruby-identifier">name</span> = <span class="ruby-ivar">@value</span>
|
179
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">name</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'import'</span>
|
180
|
+
<span class="ruby-identifier">imported_rulesets</span> = <span class="ruby-identifier">parse_import_command</span>()
|
181
|
+
<span class="ruby-identifier">rulesets</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">imported_rulesets</span>
|
182
|
+
<span class="ruby-keyword kw">else</span>
|
183
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-identifier">parse_error</span>(<span class="ruby-node">"@#{name}: unsupported command."</span>)
|
184
|
+
<span class="ruby-keyword kw">end</span>
|
185
|
+
<span class="ruby-keyword kw">end</span>
|
186
|
+
<span class="ruby-keyword kw">while</span> <span class="ruby-ivar">@token</span> <span class="ruby-operator">==</span> <span class="ruby-value">?#</span>
|
187
|
+
<span class="ruby-identifier">scan_ident</span>()
|
188
|
+
<span class="ruby-identifier">name</span> = <span class="ruby-ivar">@value</span>
|
189
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">name</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'DOCUMENT'</span>
|
190
|
+
<span class="ruby-identifier">ruleset</span> = <span class="ruby-identifier">parse_document_ruleset</span>()
|
191
|
+
<span class="ruby-keyword kw">else</span>
|
192
|
+
<span class="ruby-identifier">ruleset</span> = <span class="ruby-identifier">parse_element_ruleset</span>()
|
193
|
+
<span class="ruby-keyword kw">end</span>
|
194
|
+
<span class="ruby-identifier">rulesets</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">ruleset</span>
|
195
|
+
<span class="ruby-keyword kw">end</span>
|
196
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@token</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span>
|
197
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-identifier">parse_error</span>(<span class="ruby-node">"'#{@value}': '#name' is expected."</span>)
|
198
|
+
<span class="ruby-keyword kw">end</span>
|
199
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">rulesets</span>
|
200
|
+
<span class="ruby-keyword kw">end</span>
|
201
|
+
</pre>
|
202
|
+
</div>
|
203
|
+
</div>
|
204
|
+
</div>
|
205
|
+
|
206
|
+
<h3 class="section-bar">Protected Instance methods</h3>
|
207
|
+
|
208
|
+
<div id="method-M000042" class="method-detail">
|
209
|
+
<a name="M000042"></a>
|
210
|
+
|
211
|
+
<div class="method-heading">
|
212
|
+
<a href="#M000042" class="method-signature">
|
213
|
+
<span class="method-name">has_colon?</span><span class="method-args">()</span>
|
214
|
+
</a>
|
215
|
+
</div>
|
216
|
+
|
217
|
+
<div class="method-description">
|
218
|
+
<p><a class="source-toggle" href="#"
|
219
|
+
onclick="toggleCode('M000042-source');return false;">[Source]</a></p>
|
220
|
+
<div class="method-source-code" id="M000042-source">
|
221
|
+
<pre>
|
222
|
+
<span class="ruby-comment cmt"># File kwartz/parser.rb, line 722</span>
|
223
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">has_colon?</span>
|
224
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@ch</span> <span class="ruby-operator">==</span> <span class="ruby-value">?:</span>
|
225
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-identifier">parse_error</span>(<span class="ruby-node">"'#{@value}': ':' is required."</span>)
|
226
|
+
<span class="ruby-keyword kw">end</span>
|
227
|
+
<span class="ruby-identifier">getch</span>()
|
228
|
+
<span class="ruby-keyword kw">end</span>
|
229
|
+
</pre>
|
230
|
+
</div>
|
231
|
+
</div>
|
232
|
+
</div>
|
233
|
+
|
234
|
+
<div id="method-M000040" class="method-detail">
|
235
|
+
<a name="M000040"></a>
|
236
|
+
|
237
|
+
<div class="method-heading">
|
238
|
+
<a href="#M000040" class="method-signature">
|
239
|
+
<span class="method-name">keywords</span><span class="method-args">(keyword)</span>
|
240
|
+
</a>
|
241
|
+
</div>
|
242
|
+
|
243
|
+
<div class="method-description">
|
244
|
+
<p><a class="source-toggle" href="#"
|
245
|
+
onclick="toggleCode('M000040-source');return false;">[Source]</a></p>
|
246
|
+
<div class="method-source-code" id="M000040-source">
|
247
|
+
<pre>
|
248
|
+
<span class="ruby-comment cmt"># File kwartz/parser.rb, line 683</span>
|
249
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">keywords</span>(<span class="ruby-identifier">keyword</span>)
|
250
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-constant">CSSSTYLE_KEYWORDS</span>[<span class="ruby-identifier">keyword</span>]
|
251
|
+
<span class="ruby-keyword kw">end</span>
|
252
|
+
</pre>
|
253
|
+
</div>
|
254
|
+
</div>
|
255
|
+
</div>
|
256
|
+
|
257
|
+
<div id="method-M000041" class="method-detail">
|
258
|
+
<a name="M000041"></a>
|
259
|
+
|
260
|
+
<div class="method-heading">
|
261
|
+
<a href="#M000041" class="method-signature">
|
262
|
+
<span class="method-name">parse_document_ruleset</span><span class="method-args">()</span>
|
263
|
+
</a>
|
264
|
+
</div>
|
265
|
+
|
266
|
+
<div class="method-description">
|
267
|
+
<p><a class="source-toggle" href="#"
|
268
|
+
onclick="toggleCode('M000041-source');return false;">[Source]</a></p>
|
269
|
+
<div class="method-source-code" id="M000041-source">
|
270
|
+
<pre>
|
271
|
+
<span class="ruby-comment cmt"># File kwartz/parser.rb, line 689</span>
|
272
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse_document_ruleset</span>
|
273
|
+
<span class="ruby-identifier">assert</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@value</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'DOCUMENT'</span>
|
274
|
+
<span class="ruby-identifier">start_linenum</span> = <span class="ruby-ivar">@linenum</span>
|
275
|
+
<span class="ruby-identifier">scan</span>()
|
276
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@token</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'{'</span><span class="ruby-value str">'{'</span>
|
277
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-identifier">parse_error</span>(<span class="ruby-node">"'#{@value}': '{' is expected."</span>)
|
278
|
+
<span class="ruby-keyword kw">end</span>
|
279
|
+
<span class="ruby-identifier">ruleset</span> = <span class="ruby-constant">DocumentRuleset</span>.<span class="ruby-identifier">new</span>
|
280
|
+
<span class="ruby-keyword kw">while</span> <span class="ruby-ivar">@token</span>
|
281
|
+
<span class="ruby-identifier">scan</span>()
|
282
|
+
<span class="ruby-keyword kw">case</span> <span class="ruby-ivar">@token</span>
|
283
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">'}'</span><span class="ruby-value str">'}'</span> ; <span class="ruby-keyword kw">break</span>
|
284
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:global</span> ; <span class="ruby-identifier">has_colon?</span>(); <span class="ruby-identifier">ruleset</span>.<span class="ruby-identifier">set_global</span> <span class="ruby-identifier">_parse_words</span>()
|
285
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:local</span> ; <span class="ruby-identifier">has_colon?</span>(); <span class="ruby-identifier">ruleset</span>.<span class="ruby-identifier">set_local</span> <span class="ruby-identifier">_parse_words</span>()
|
286
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:fixture</span> ; <span class="ruby-identifier">has_colon?</span>(); <span class="ruby-identifier">ruleset</span>.<span class="ruby-identifier">set_fixture</span> <span class="ruby-identifier">_parse_block</span>()
|
287
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:begin</span> ; <span class="ruby-identifier">has_colon?</span>(); <span class="ruby-identifier">ruleset</span>.<span class="ruby-identifier">set_begin</span> <span class="ruby-identifier">_parse_block</span>()
|
288
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:end</span> ; <span class="ruby-identifier">has_colon?</span>(); <span class="ruby-identifier">ruleset</span>.<span class="ruby-identifier">set_end</span> <span class="ruby-identifier">_parse_block</span>()
|
289
|
+
<span class="ruby-comment cmt">#when :before ; has_colon?(); ruleset.set_before _parse_block()</span>
|
290
|
+
<span class="ruby-comment cmt">#when :after ; has_colon?(); ruleset.set_after _parse_block()</span>
|
291
|
+
<span class="ruby-keyword kw">else</span>
|
292
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@token</span>
|
293
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-identifier">parse_error</span>(<span class="ruby-value str">"'#DOCUMENT': is not closed by '}'."</span>, <span class="ruby-identifier">start_linenum</span>)
|
294
|
+
<span class="ruby-keyword kw">else</span>
|
295
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-identifier">parse_error</span>(<span class="ruby-node">"'#{@value}': unexpected token."</span>)
|
296
|
+
<span class="ruby-keyword kw">end</span>
|
297
|
+
<span class="ruby-keyword kw">end</span>
|
298
|
+
<span class="ruby-keyword kw">end</span>
|
299
|
+
<span class="ruby-identifier">assert</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@token</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'}'</span><span class="ruby-value str">'}'</span>
|
300
|
+
<span class="ruby-identifier">scan</span>()
|
301
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">ruleset</span>
|
302
|
+
<span class="ruby-keyword kw">end</span>
|
303
|
+
</pre>
|
304
|
+
</div>
|
305
|
+
</div>
|
306
|
+
</div>
|
307
|
+
|
308
|
+
<div id="method-M000043" class="method-detail">
|
309
|
+
<a name="M000043"></a>
|
310
|
+
|
311
|
+
<div class="method-heading">
|
312
|
+
<a href="#M000043" class="method-signature">
|
313
|
+
<span class="method-name">parse_element_ruleset</span><span class="method-args">()</span>
|
314
|
+
</a>
|
315
|
+
</div>
|
316
|
+
|
317
|
+
<div class="method-description">
|
318
|
+
<p><a class="source-toggle" href="#"
|
319
|
+
onclick="toggleCode('M000043-source');return false;">[Source]</a></p>
|
320
|
+
<div class="method-source-code" id="M000043-source">
|
321
|
+
<pre>
|
322
|
+
<span class="ruby-comment cmt"># File kwartz/parser.rb, line 730</span>
|
323
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse_element_ruleset</span>
|
324
|
+
<span class="ruby-identifier">assert</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@token</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:ident</span>
|
325
|
+
<span class="ruby-identifier">start_linenum</span> = <span class="ruby-ivar">@linenum</span>
|
326
|
+
<span class="ruby-identifier">name</span> = <span class="ruby-ivar">@value</span>
|
327
|
+
<span class="ruby-identifier">scan</span>()
|
328
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@token</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'{'</span><span class="ruby-value str">'{'</span>
|
329
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-identifier">parse_error</span>(<span class="ruby-node">"'#{@value}': '{' is expected."</span>)
|
330
|
+
<span class="ruby-keyword kw">end</span>
|
331
|
+
<span class="ruby-identifier">ruleset</span> = <span class="ruby-constant">ElementRuleset</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">name</span>)
|
332
|
+
<span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">true</span>
|
333
|
+
<span class="ruby-identifier">scan</span>()
|
334
|
+
<span class="ruby-identifier">flag_escape</span> = <span class="ruby-identifier">escape?</span>(<span class="ruby-ivar">@value</span>)
|
335
|
+
<span class="ruby-keyword kw">case</span> <span class="ruby-ivar">@token</span>
|
336
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-keyword kw">nil</span> ; <span class="ruby-keyword kw">break</span>
|
337
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">'}'</span><span class="ruby-value str">'}'</span> ; <span class="ruby-keyword kw">break</span>
|
338
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:stag</span> ; <span class="ruby-identifier">has_colon?</span>(); <span class="ruby-identifier">ruleset</span>.<span class="ruby-identifier">set_stag</span> <span class="ruby-identifier">_parse_expr</span>() , <span class="ruby-identifier">flag_escape</span>
|
339
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:cont</span> ; <span class="ruby-identifier">has_colon?</span>(); <span class="ruby-identifier">ruleset</span>.<span class="ruby-identifier">set_cont</span> <span class="ruby-identifier">_parse_expr</span>() , <span class="ruby-identifier">flag_escape</span>
|
340
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:etag</span> ; <span class="ruby-identifier">has_colon?</span>(); <span class="ruby-identifier">ruleset</span>.<span class="ruby-identifier">set_etag</span> <span class="ruby-identifier">_parse_expr</span>() , <span class="ruby-identifier">flag_escape</span>
|
341
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:elem</span> ; <span class="ruby-identifier">has_colon?</span>(); <span class="ruby-identifier">ruleset</span>.<span class="ruby-identifier">set_elem</span> <span class="ruby-identifier">_parse_expr</span>() , <span class="ruby-identifier">flag_escape</span>
|
342
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:value</span> ; <span class="ruby-identifier">has_colon?</span>(); <span class="ruby-identifier">ruleset</span>.<span class="ruby-identifier">set_value</span> <span class="ruby-identifier">_parse_expr</span>() , <span class="ruby-identifier">flag_escape</span>
|
343
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:attrs</span> ; <span class="ruby-identifier">has_colon?</span>(); <span class="ruby-identifier">ruleset</span>.<span class="ruby-identifier">set_attrs</span> <span class="ruby-identifier">_parse_pairs</span>(), <span class="ruby-identifier">flag_escape</span>
|
344
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:append</span> ; <span class="ruby-identifier">has_colon?</span>(); <span class="ruby-identifier">ruleset</span>.<span class="ruby-identifier">set_append</span> <span class="ruby-identifier">_parse_exprs</span>(), <span class="ruby-identifier">flag_escape</span>
|
345
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:remove</span> ; <span class="ruby-identifier">has_colon?</span>(); <span class="ruby-identifier">ruleset</span>.<span class="ruby-identifier">set_remove</span> <span class="ruby-identifier">_parse_strs</span>()
|
346
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:tagname</span>; <span class="ruby-identifier">has_colon?</span>(); <span class="ruby-identifier">ruleset</span>.<span class="ruby-identifier">set_tagname</span> <span class="ruby-identifier">_parse_str</span>()
|
347
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:logic</span> ; <span class="ruby-identifier">has_colon?</span>(); <span class="ruby-identifier">ruleset</span>.<span class="ruby-identifier">set_logic</span> <span class="ruby-identifier">_parse_block</span>()
|
348
|
+
<span class="ruby-keyword kw">else</span>
|
349
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-identifier">parse_error</span>(<span class="ruby-node">"'#{@value}': unexpected token."</span>)
|
350
|
+
<span class="ruby-keyword kw">end</span>
|
351
|
+
<span class="ruby-keyword kw">end</span>
|
352
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@token</span>
|
353
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-identifier">parse_error</span>(<span class="ruby-node">"'##{name}': is not closed by '}'."</span>, <span class="ruby-identifier">start_linenum</span>)
|
354
|
+
<span class="ruby-keyword kw">end</span>
|
355
|
+
<span class="ruby-identifier">assert</span> <span class="ruby-node">"@token=#{@token.inspect}"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@token</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'}'</span><span class="ruby-value str">'}'</span>
|
356
|
+
<span class="ruby-identifier">scan</span>()
|
357
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">ruleset</span>
|
358
|
+
<span class="ruby-keyword kw">end</span>
|
359
|
+
</pre>
|
360
|
+
</div>
|
361
|
+
</div>
|
362
|
+
</div>
|
363
|
+
|
364
|
+
<div id="method-M000044" class="method-detail">
|
365
|
+
<a name="M000044"></a>
|
366
|
+
|
367
|
+
<div class="method-heading">
|
368
|
+
<a href="#M000044" class="method-signature">
|
369
|
+
<span class="method-name">parse_import_command</span><span class="method-args">()</span>
|
370
|
+
</a>
|
371
|
+
</div>
|
372
|
+
|
373
|
+
<div class="method-description">
|
374
|
+
<p><a class="source-toggle" href="#"
|
375
|
+
onclick="toggleCode('M000044-source');return false;">[Source]</a></p>
|
376
|
+
<div class="method-source-code" id="M000044-source">
|
377
|
+
<pre>
|
378
|
+
<span class="ruby-comment cmt"># File kwartz/parser.rb, line 768</span>
|
379
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse_import_command</span>
|
380
|
+
<span class="ruby-identifier">c</span> = <span class="ruby-ivar">@ch</span>
|
381
|
+
<span class="ruby-identifier">c</span> = <span class="ruby-identifier">getch</span>() <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">is_whitespace</span>(<span class="ruby-identifier">c</span>)
|
382
|
+
<span class="ruby-identifier">t</span> = <span class="ruby-identifier">scan_string</span>()
|
383
|
+
<span class="ruby-identifier">t</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:string</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">raise</span> <span class="ruby-identifier">parse_error</span>(<span class="ruby-value str">"@import: requires filename."</span>)
|
384
|
+
<span class="ruby-identifier">filename</span> = <span class="ruby-ivar">@value</span>
|
385
|
+
<span class="ruby-identifier">test</span>(<span class="ruby-value">?f</span>, <span class="ruby-identifier">filename</span>) <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">raise</span> <span class="ruby-identifier">parse_error</span>(<span class="ruby-node">"'#{filename}': import file not found."</span>)
|
386
|
+
<span class="ruby-identifier">c</span> = <span class="ruby-ivar">@ch</span>
|
387
|
+
<span class="ruby-identifier">c</span> = <span class="ruby-identifier">getch</span>() <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">is_whitespace</span>(<span class="ruby-identifier">c</span>)
|
388
|
+
<span class="ruby-identifier">c</span> <span class="ruby-operator">==</span> <span class="ruby-value">?;</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">raise</span> <span class="ruby-identifier">parse_error</span>(<span class="ruby-value str">"';' required."</span>)
|
389
|
+
<span class="ruby-identifier">c</span> = <span class="ruby-identifier">getch</span>()
|
390
|
+
<span class="ruby-identifier">scan</span>()
|
391
|
+
<span class="ruby-identifier">parser</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@properties</span>)
|
392
|
+
<span class="ruby-identifier">ruleset_list</span> = <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">filename</span>), <span class="ruby-identifier">filename</span>)
|
393
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">ruleset_list</span>
|
394
|
+
<span class="ruby-keyword kw">end</span>
|
395
|
+
</pre>
|
396
|
+
</div>
|
397
|
+
</div>
|
398
|
+
</div>
|
399
|
+
|
400
|
+
<div id="method-M000039" class="method-detail">
|
401
|
+
<a name="M000039"></a>
|
402
|
+
|
403
|
+
<div class="method-heading">
|
404
|
+
<a href="#M000039" class="method-signature">
|
405
|
+
<span class="method-name">scan_hook</span><span class="method-args">()</span>
|
406
|
+
</a>
|
407
|
+
</div>
|
408
|
+
|
409
|
+
<div class="method-description">
|
410
|
+
<p><a class="source-toggle" href="#"
|
411
|
+
onclick="toggleCode('M000039-source');return false;">[Source]</a></p>
|
412
|
+
<div class="method-source-code" id="M000039-source">
|
413
|
+
<pre>
|
414
|
+
<span class="ruby-comment cmt"># File kwartz/parser.rb, line 630</span>
|
415
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">scan_hook</span>
|
416
|
+
<span class="ruby-comment cmt">## comment</span>
|
417
|
+
<span class="ruby-identifier">c</span> = <span class="ruby-ivar">@ch</span>
|
418
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">c</span> <span class="ruby-operator">==</span> <span class="ruby-value">?/</span>
|
419
|
+
<span class="ruby-identifier">c</span> = <span class="ruby-identifier">getch</span>()
|
420
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">c</span> <span class="ruby-operator">==</span> <span class="ruby-value">?/</span> <span class="ruby-comment cmt"># line comment</span>
|
421
|
+
<span class="ruby-identifier">scan_line</span>()
|
422
|
+
<span class="ruby-identifier">getch</span>()
|
423
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">scan</span>()
|
424
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">c</span> <span class="ruby-operator">==</span> <span class="ruby-value">?*</span> <span class="ruby-comment cmt"># region comment</span>
|
425
|
+
<span class="ruby-identifier">start_linenum</span> = <span class="ruby-ivar">@linenum</span>
|
426
|
+
<span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">true</span>
|
427
|
+
<span class="ruby-identifier">c</span> = <span class="ruby-identifier">getch</span>() <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">c</span> <span class="ruby-operator">!=</span> <span class="ruby-value">?*</span>
|
428
|
+
<span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">c</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span>
|
429
|
+
<span class="ruby-identifier">c</span> = <span class="ruby-identifier">getch</span>()
|
430
|
+
<span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">c</span> <span class="ruby-operator">==</span> <span class="ruby-value">?/</span>
|
431
|
+
<span class="ruby-keyword kw">end</span>
|
432
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">c</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span>
|
433
|
+
<span class="ruby-ivar">@error</span> = <span class="ruby-identifier">:comment_unclosed</span>
|
434
|
+
<span class="ruby-ivar">@value</span> = <span class="ruby-identifier">start_linenum</span>
|
435
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@token</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:error</span>
|
436
|
+
<span class="ruby-keyword kw">end</span>
|
437
|
+
<span class="ruby-identifier">getch</span>()
|
438
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">scan</span>()
|
439
|
+
<span class="ruby-keyword kw">else</span>
|
440
|
+
<span class="ruby-ivar">@value</span> = <span class="ruby-value str">'/'</span>
|
441
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@token</span> = <span class="ruby-value">?/</span>
|
442
|
+
<span class="ruby-keyword kw">end</span> <span class="ruby-comment cmt">#if</span>
|
443
|
+
<span class="ruby-keyword kw">end</span> <span class="ruby-comment cmt">#if</span>
|
444
|
+
|
445
|
+
<span class="ruby-comment cmt">## '#mark'</span>
|
446
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">c</span> <span class="ruby-operator">==</span> <span class="ruby-value">?#</span>
|
447
|
+
<span class="ruby-identifier">c</span> = <span class="ruby-identifier">getch</span>()
|
448
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">is_alpha</span>(<span class="ruby-identifier">c</span>)
|
449
|
+
<span class="ruby-ivar">@error</span> = <span class="ruby-identifier">:invalid_char</span>
|
450
|
+
<span class="ruby-ivar">@value</span> = <span class="ruby-value str">'#'</span>
|
451
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@token</span> = <span class="ruby-identifier">:error</span>
|
452
|
+
<span class="ruby-keyword kw">end</span>
|
453
|
+
<span class="ruby-ivar">@value</span> = <span class="ruby-value str">'#'</span>
|
454
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@token</span> = <span class="ruby-value">?#</span>
|
455
|
+
<span class="ruby-keyword kw">end</span> <span class="ruby-comment cmt">#if</span>
|
456
|
+
|
457
|
+
<span class="ruby-comment cmt">## '@import "foo.plogic"'</span>
|
458
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">c</span> <span class="ruby-operator">==</span> <span class="ruby-value">?@</span>
|
459
|
+
<span class="ruby-ivar">@value</span> = <span class="ruby-value str">'@'</span>
|
460
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@token</span> = <span class="ruby-value">?@</span>
|
461
|
+
<span class="ruby-keyword kw">end</span>
|
462
|
+
|
463
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
|
464
|
+
|
465
|
+
<span class="ruby-keyword kw">end</span>
|
466
|
+
</pre>
|
467
|
+
</div>
|
468
|
+
</div>
|
469
|
+
</div>
|
470
|
+
|
471
|
+
|
472
|
+
</div>
|
473
|
+
|
474
|
+
|
475
|
+
</div>
|
476
|
+
|
477
|
+
|
478
|
+
<div id="validator-badges">
|
479
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
480
|
+
</div>
|
481
|
+
|
482
|
+
</body>
|
483
|
+
</html>
|