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,167 @@
|
|
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::RailsTranslator</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::RailsTranslator</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/kwartz/binding/rails_rb.html">
|
59
|
+
kwartz/binding/rails.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
<a href="BaseTranslator.html">
|
69
|
+
BaseTranslator
|
70
|
+
</a>
|
71
|
+
</td>
|
72
|
+
</tr>
|
73
|
+
</table>
|
74
|
+
</div>
|
75
|
+
<!-- banner header -->
|
76
|
+
|
77
|
+
<div id="bodyContent">
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<div id="contextContent">
|
82
|
+
|
83
|
+
<div id="description">
|
84
|
+
<p>
|
85
|
+
translator for rails
|
86
|
+
</p>
|
87
|
+
|
88
|
+
</div>
|
89
|
+
|
90
|
+
|
91
|
+
</div>
|
92
|
+
|
93
|
+
<div id="method-list">
|
94
|
+
<h3 class="section-bar">Methods</h3>
|
95
|
+
|
96
|
+
<div class="name-list">
|
97
|
+
<a href="#M000113">new</a>
|
98
|
+
</div>
|
99
|
+
</div>
|
100
|
+
|
101
|
+
</div>
|
102
|
+
|
103
|
+
|
104
|
+
<!-- if includes -->
|
105
|
+
|
106
|
+
<div id="section">
|
107
|
+
|
108
|
+
|
109
|
+
<div id="constants-list">
|
110
|
+
<h3 class="section-bar">Constants</h3>
|
111
|
+
|
112
|
+
<div class="name-list">
|
113
|
+
<table summary="Constants">
|
114
|
+
<tr class="top-aligned-row context-row">
|
115
|
+
<td class="context-item-name">RAILS_EMBED_PATTERNS</td>
|
116
|
+
<td>=</td>
|
117
|
+
<td class="context-item-value">[ '<% ', ' -%>', # statement (chop newline) '<%= ', ' %>', # expression '<%=h ', ' %>', # escaped expression ]</td>
|
118
|
+
</tr>
|
119
|
+
</table>
|
120
|
+
</div>
|
121
|
+
</div>
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
<!-- if method_list -->
|
129
|
+
<div id="methods">
|
130
|
+
<h3 class="section-bar">Public Class methods</h3>
|
131
|
+
|
132
|
+
<div id="method-M000113" class="method-detail">
|
133
|
+
<a name="M000113"></a>
|
134
|
+
|
135
|
+
<div class="method-heading">
|
136
|
+
<a href="#M000113" class="method-signature">
|
137
|
+
<span class="method-name">new</span><span class="method-args">(properties={})</span>
|
138
|
+
</a>
|
139
|
+
</div>
|
140
|
+
|
141
|
+
<div class="method-description">
|
142
|
+
<p><a class="source-toggle" href="#"
|
143
|
+
onclick="toggleCode('M000113-source');return false;">[Source]</a></p>
|
144
|
+
<div class="method-source-code" id="M000113-source">
|
145
|
+
<pre>
|
146
|
+
<span class="ruby-comment cmt"># File kwartz/binding/rails.rb, line 285</span>
|
147
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">properties</span>={})
|
148
|
+
<span class="ruby-keyword kw">super</span>(<span class="ruby-constant">RAILS_EMBED_PATTERNS</span>, <span class="ruby-identifier">properties</span>)
|
149
|
+
<span class="ruby-keyword kw">end</span>
|
150
|
+
</pre>
|
151
|
+
</div>
|
152
|
+
</div>
|
153
|
+
</div>
|
154
|
+
|
155
|
+
|
156
|
+
</div>
|
157
|
+
|
158
|
+
|
159
|
+
</div>
|
160
|
+
|
161
|
+
|
162
|
+
<div id="validator-badges">
|
163
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
164
|
+
</div>
|
165
|
+
|
166
|
+
</body>
|
167
|
+
</html>
|
@@ -0,0 +1,558 @@
|
|
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::RubyStyleParser</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::RubyStyleParser</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
|
+
ruby style presentation logic parser
|
86
|
+
</p>
|
87
|
+
<p>
|
88
|
+
presentation logic example (ruby style):
|
89
|
+
</p>
|
90
|
+
<pre>
|
91
|
+
# comment
|
92
|
+
element "list" {
|
93
|
+
value @var
|
94
|
+
attrs "class"=>@clssname, "bgcolor"=>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="#M000106">_parse_block</a>
|
116
|
+
<a href="#M000105">_parse_item</a>
|
117
|
+
<a href="#M000102">_parse_list</a>
|
118
|
+
<a href="#M000104">_parse_str</a>
|
119
|
+
<a href="#M000103">_parse_strs</a>
|
120
|
+
<a href="#M000107">_parse_tuples</a>
|
121
|
+
<a href="#M000101">has_space?</a>
|
122
|
+
<a href="#M000099">keywords</a>
|
123
|
+
<a href="#M000097">parse</a>
|
124
|
+
<a href="#M000100">parse_document_ruleset</a>
|
125
|
+
<a href="#M000108">parse_element_ruleset</a>
|
126
|
+
<a href="#M000098">scan_hook</a>
|
127
|
+
</div>
|
128
|
+
</div>
|
129
|
+
|
130
|
+
</div>
|
131
|
+
|
132
|
+
|
133
|
+
<!-- if includes -->
|
134
|
+
|
135
|
+
<div id="section">
|
136
|
+
|
137
|
+
|
138
|
+
<div id="constants-list">
|
139
|
+
<h3 class="section-bar">Constants</h3>
|
140
|
+
|
141
|
+
<div class="name-list">
|
142
|
+
<table summary="Constants">
|
143
|
+
<tr class="top-aligned-row context-row">
|
144
|
+
<td class="context-item-name">RUBYSTYLE_KEYWORDS</td>
|
145
|
+
<td>=</td>
|
146
|
+
<td class="context-item-value">{ 'BEGIN' => :BEGIN, 'END' => :END }</td>
|
147
|
+
</tr>
|
148
|
+
</table>
|
149
|
+
</div>
|
150
|
+
</div>
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
<!-- if method_list -->
|
158
|
+
<div id="methods">
|
159
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
160
|
+
|
161
|
+
<div id="method-M000097" class="method-detail">
|
162
|
+
<a name="M000097"></a>
|
163
|
+
|
164
|
+
<div class="method-heading">
|
165
|
+
<a href="#M000097" class="method-signature">
|
166
|
+
<span class="method-name">parse</span><span class="method-args">(input, filename='')</span>
|
167
|
+
</a>
|
168
|
+
</div>
|
169
|
+
|
170
|
+
<div class="method-description">
|
171
|
+
<p><a class="source-toggle" href="#"
|
172
|
+
onclick="toggleCode('M000097-source');return false;">[Source]</a></p>
|
173
|
+
<div class="method-source-code" id="M000097-source">
|
174
|
+
<pre>
|
175
|
+
<span class="ruby-comment cmt"># File kwartz/parser.rb, line 397</span>
|
176
|
+
<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>)
|
177
|
+
<span class="ruby-identifier">reset</span>(<span class="ruby-identifier">input</span>, <span class="ruby-identifier">filename</span>)
|
178
|
+
<span class="ruby-identifier">scan</span>()
|
179
|
+
<span class="ruby-identifier">nodes</span> = []
|
180
|
+
<span class="ruby-keyword kw">while</span> <span class="ruby-ivar">@token</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
|
181
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@token</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:element</span>
|
182
|
+
<span class="ruby-identifier">node</span> = <span class="ruby-identifier">parse_element_ruleset</span>()
|
183
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-ivar">@token</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:document</span>
|
184
|
+
<span class="ruby-identifier">node</span> = <span class="ruby-identifier">parse_document_ruleset</span>()
|
185
|
+
<span class="ruby-keyword kw">else</span>
|
186
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-identifier">parse_error</span>(<span class="ruby-node">"'#{@value}': element or document required."</span>)
|
187
|
+
<span class="ruby-keyword kw">end</span>
|
188
|
+
<span class="ruby-identifier">nodes</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">node</span>
|
189
|
+
<span class="ruby-keyword kw">end</span>
|
190
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">nodes</span>
|
191
|
+
<span class="ruby-keyword kw">end</span>
|
192
|
+
</pre>
|
193
|
+
</div>
|
194
|
+
</div>
|
195
|
+
</div>
|
196
|
+
|
197
|
+
<h3 class="section-bar">Protected Instance methods</h3>
|
198
|
+
|
199
|
+
<div id="method-M000106" class="method-detail">
|
200
|
+
<a name="M000106"></a>
|
201
|
+
|
202
|
+
<div class="method-heading">
|
203
|
+
<a href="#M000106" class="method-signature">
|
204
|
+
<span class="method-name">_parse_block</span><span class="method-args">()</span>
|
205
|
+
</a>
|
206
|
+
</div>
|
207
|
+
|
208
|
+
<div class="method-description">
|
209
|
+
<p><a class="source-toggle" href="#"
|
210
|
+
onclick="toggleCode('M000106-source');return false;">[Source]</a></p>
|
211
|
+
<div class="method-source-code" id="M000106-source">
|
212
|
+
<pre>
|
213
|
+
<span class="ruby-comment cmt"># File kwartz/parser.rb, line 503</span>
|
214
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">_parse_block</span>
|
215
|
+
<span class="ruby-keyword kw">super</span>
|
216
|
+
<span class="ruby-keyword kw">end</span>
|
217
|
+
</pre>
|
218
|
+
</div>
|
219
|
+
</div>
|
220
|
+
</div>
|
221
|
+
|
222
|
+
<div id="method-M000105" class="method-detail">
|
223
|
+
<a name="M000105"></a>
|
224
|
+
|
225
|
+
<div class="method-heading">
|
226
|
+
<a href="#M000105" class="method-signature">
|
227
|
+
<span class="method-name">_parse_item</span><span class="method-args">()</span>
|
228
|
+
</a>
|
229
|
+
</div>
|
230
|
+
|
231
|
+
<div class="method-description">
|
232
|
+
<p><a class="source-toggle" href="#"
|
233
|
+
onclick="toggleCode('M000105-source');return false;">[Source]</a></p>
|
234
|
+
<div class="method-source-code" id="M000105-source">
|
235
|
+
<pre>
|
236
|
+
<span class="ruby-comment cmt"># File kwartz/parser.rb, line 496</span>
|
237
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">_parse_item</span>
|
238
|
+
<span class="ruby-identifier">item</span> = <span class="ruby-identifier">scan_line</span>()
|
239
|
+
<span class="ruby-identifier">item</span>.<span class="ruby-identifier">strip!</span>
|
240
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">item</span>
|
241
|
+
<span class="ruby-keyword kw">end</span>
|
242
|
+
</pre>
|
243
|
+
</div>
|
244
|
+
</div>
|
245
|
+
</div>
|
246
|
+
|
247
|
+
<div id="method-M000102" class="method-detail">
|
248
|
+
<a name="M000102"></a>
|
249
|
+
|
250
|
+
<div class="method-heading">
|
251
|
+
<a href="#M000102" class="method-signature">
|
252
|
+
<span class="method-name">_parse_list</span><span class="method-args">()</span>
|
253
|
+
</a>
|
254
|
+
</div>
|
255
|
+
|
256
|
+
<div class="method-description">
|
257
|
+
<p><a class="source-toggle" href="#"
|
258
|
+
onclick="toggleCode('M000102-source');return false;">[Source]</a></p>
|
259
|
+
<div class="method-source-code" id="M000102-source">
|
260
|
+
<pre>
|
261
|
+
<span class="ruby-comment cmt"># File kwartz/parser.rb, line 469</span>
|
262
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">_parse_list</span>
|
263
|
+
<span class="ruby-identifier">line</span> = <span class="ruby-identifier">scan_line</span>()
|
264
|
+
<span class="ruby-identifier">list</span> = <span class="ruby-identifier">line</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp re">/,\s+/</span>).<span class="ruby-identifier">collect</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span> <span class="ruby-identifier">item</span>.<span class="ruby-identifier">strip</span>}
|
265
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">list</span>
|
266
|
+
<span class="ruby-keyword kw">end</span>
|
267
|
+
</pre>
|
268
|
+
</div>
|
269
|
+
</div>
|
270
|
+
</div>
|
271
|
+
|
272
|
+
<div id="method-M000104" class="method-detail">
|
273
|
+
<a name="M000104"></a>
|
274
|
+
|
275
|
+
<div class="method-heading">
|
276
|
+
<a href="#M000104" class="method-signature">
|
277
|
+
<span class="method-name">_parse_str</span><span class="method-args">()</span>
|
278
|
+
</a>
|
279
|
+
</div>
|
280
|
+
|
281
|
+
<div class="method-description">
|
282
|
+
<p><a class="source-toggle" href="#"
|
283
|
+
onclick="toggleCode('M000104-source');return false;">[Source]</a></p>
|
284
|
+
<div class="method-source-code" id="M000104-source">
|
285
|
+
<pre>
|
286
|
+
<span class="ruby-comment cmt"># File kwartz/parser.rb, line 491</span>
|
287
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">_parse_str</span>
|
288
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">_parse_strs</span>()[<span class="ruby-value">0</span>]
|
289
|
+
<span class="ruby-keyword kw">end</span>
|
290
|
+
</pre>
|
291
|
+
</div>
|
292
|
+
</div>
|
293
|
+
</div>
|
294
|
+
|
295
|
+
<div id="method-M000103" class="method-detail">
|
296
|
+
<a name="M000103"></a>
|
297
|
+
|
298
|
+
<div class="method-heading">
|
299
|
+
<a href="#M000103" class="method-signature">
|
300
|
+
<span class="method-name">_parse_strs</span><span class="method-args">()</span>
|
301
|
+
</a>
|
302
|
+
</div>
|
303
|
+
|
304
|
+
<div class="method-description">
|
305
|
+
<p><a class="source-toggle" href="#"
|
306
|
+
onclick="toggleCode('M000103-source');return false;">[Source]</a></p>
|
307
|
+
<div class="method-source-code" id="M000103-source">
|
308
|
+
<pre>
|
309
|
+
<span class="ruby-comment cmt"># File kwartz/parser.rb, line 476</span>
|
310
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">_parse_strs</span>
|
311
|
+
<span class="ruby-identifier">list</span> = <span class="ruby-identifier">_parse_list</span>()
|
312
|
+
<span class="ruby-identifier">list2</span> = []
|
313
|
+
<span class="ruby-identifier">list</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span>
|
314
|
+
<span class="ruby-keyword kw">case</span> <span class="ruby-identifier">item</span>
|
315
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">/\A"(.*)"\z/</span> ; <span class="ruby-identifier">list2</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">$1</span>
|
316
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">/\A'(.*)'\z/</span> ; <span class="ruby-identifier">list2</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">$1</span>
|
317
|
+
<span class="ruby-keyword kw">else</span>
|
318
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-identifier">parse_error</span>(<span class="ruby-node">"'#{item}': argument of 'remove' should be string."</span>)
|
319
|
+
<span class="ruby-keyword kw">end</span>
|
320
|
+
<span class="ruby-keyword kw">end</span>
|
321
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">list2</span>
|
322
|
+
<span class="ruby-keyword kw">end</span>
|
323
|
+
</pre>
|
324
|
+
</div>
|
325
|
+
</div>
|
326
|
+
</div>
|
327
|
+
|
328
|
+
<div id="method-M000107" class="method-detail">
|
329
|
+
<a name="M000107"></a>
|
330
|
+
|
331
|
+
<div class="method-heading">
|
332
|
+
<a href="#M000107" class="method-signature">
|
333
|
+
<span class="method-name">_parse_tuples</span><span class="method-args">()</span>
|
334
|
+
</a>
|
335
|
+
</div>
|
336
|
+
|
337
|
+
<div class="method-description">
|
338
|
+
<p><a class="source-toggle" href="#"
|
339
|
+
onclick="toggleCode('M000107-source');return false;">[Source]</a></p>
|
340
|
+
<div class="method-source-code" id="M000107-source">
|
341
|
+
<pre>
|
342
|
+
<span class="ruby-comment cmt"># File kwartz/parser.rb, line 508</span>
|
343
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">_parse_tuples</span>
|
344
|
+
<span class="ruby-identifier">line</span> = <span class="ruby-identifier">scan_line</span>()
|
345
|
+
<span class="ruby-identifier">items</span> = <span class="ruby-identifier">line</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp re">/,\s+/</span>)
|
346
|
+
<span class="ruby-identifier">tuples</span> = []
|
347
|
+
<span class="ruby-identifier">items</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span>
|
348
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">item</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/(.*?)=>(.*)/</span>
|
349
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-identifier">parse_error</span>(<span class="ruby-node">"'#{item}': invalid pattern."</span>)
|
350
|
+
<span class="ruby-keyword kw">end</span>
|
351
|
+
<span class="ruby-identifier">key</span> = <span class="ruby-identifier">$1</span>; <span class="ruby-identifier">key</span>.<span class="ruby-identifier">strip!</span>
|
352
|
+
<span class="ruby-identifier">val</span> = <span class="ruby-identifier">$2</span>; <span class="ruby-identifier">val</span>.<span class="ruby-identifier">strip!</span>
|
353
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">key</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/\A"(.*)"\z/</span>
|
354
|
+
<span class="ruby-identifier">key</span> = <span class="ruby-identifier">$1</span>
|
355
|
+
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">key</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/\A'(.*)'\z/</span>
|
356
|
+
<span class="ruby-identifier">key</span> = <span class="ruby-identifier">$1</span>
|
357
|
+
<span class="ruby-keyword kw">else</span>
|
358
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-identifier">parse_error</span>(<span class="ruby-node">"'#{key}': key must be \"...\" or '...'."</span>) <span class="ruby-comment cmt">#</span>
|
359
|
+
<span class="ruby-keyword kw">end</span>
|
360
|
+
<span class="ruby-identifier">tuples</span> <span class="ruby-operator"><<</span> [<span class="ruby-identifier">key</span>, <span class="ruby-identifier">val</span>]
|
361
|
+
<span class="ruby-keyword kw">end</span>
|
362
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">tuples</span>
|
363
|
+
<span class="ruby-keyword kw">end</span>
|
364
|
+
</pre>
|
365
|
+
</div>
|
366
|
+
</div>
|
367
|
+
</div>
|
368
|
+
|
369
|
+
<div id="method-M000101" class="method-detail">
|
370
|
+
<a name="M000101"></a>
|
371
|
+
|
372
|
+
<div class="method-heading">
|
373
|
+
<a href="#M000101" class="method-signature">
|
374
|
+
<span class="method-name">has_space?</span><span class="method-args">()</span>
|
375
|
+
</a>
|
376
|
+
</div>
|
377
|
+
|
378
|
+
<div class="method-description">
|
379
|
+
<p><a class="source-toggle" href="#"
|
380
|
+
onclick="toggleCode('M000101-source');return false;">[Source]</a></p>
|
381
|
+
<div class="method-source-code" id="M000101-source">
|
382
|
+
<pre>
|
383
|
+
<span class="ruby-comment cmt"># File kwartz/parser.rb, line 462</span>
|
384
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">has_space?</span>
|
385
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@ch</span> <span class="ruby-operator">==</span> <span class="ruby-value">?\ </span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@ch</span> <span class="ruby-operator">==</span> <span class="ruby-value">?\t</span>
|
386
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-identifier">parse_error</span>(<span class="ruby-node">"'#{@value}': following spaces are required but got '#{@ch.chr}'."</span>)
|
387
|
+
<span class="ruby-keyword kw">end</span>
|
388
|
+
<span class="ruby-keyword kw">end</span>
|
389
|
+
</pre>
|
390
|
+
</div>
|
391
|
+
</div>
|
392
|
+
</div>
|
393
|
+
|
394
|
+
<div id="method-M000099" class="method-detail">
|
395
|
+
<a name="M000099"></a>
|
396
|
+
|
397
|
+
<div class="method-heading">
|
398
|
+
<a href="#M000099" class="method-signature">
|
399
|
+
<span class="method-name">keywords</span><span class="method-args">(keyword)</span>
|
400
|
+
</a>
|
401
|
+
</div>
|
402
|
+
|
403
|
+
<div class="method-description">
|
404
|
+
<p><a class="source-toggle" href="#"
|
405
|
+
onclick="toggleCode('M000099-source');return false;">[Source]</a></p>
|
406
|
+
<div class="method-source-code" id="M000099-source">
|
407
|
+
<pre>
|
408
|
+
<span class="ruby-comment cmt"># File kwartz/parser.rb, line 429</span>
|
409
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">keywords</span>(<span class="ruby-identifier">keyword</span>)
|
410
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-constant">RUBYSTYLE_KEYWORDS</span>[<span class="ruby-identifier">keyword</span>]
|
411
|
+
<span class="ruby-keyword kw">end</span>
|
412
|
+
</pre>
|
413
|
+
</div>
|
414
|
+
</div>
|
415
|
+
</div>
|
416
|
+
|
417
|
+
<div id="method-M000100" class="method-detail">
|
418
|
+
<a name="M000100"></a>
|
419
|
+
|
420
|
+
<div class="method-heading">
|
421
|
+
<a href="#M000100" class="method-signature">
|
422
|
+
<span class="method-name">parse_document_ruleset</span><span class="method-args">()</span>
|
423
|
+
</a>
|
424
|
+
</div>
|
425
|
+
|
426
|
+
<div class="method-description">
|
427
|
+
<p><a class="source-toggle" href="#"
|
428
|
+
onclick="toggleCode('M000100-source');return false;">[Source]</a></p>
|
429
|
+
<div class="method-source-code" id="M000100-source">
|
430
|
+
<pre>
|
431
|
+
<span class="ruby-comment cmt"># File kwartz/parser.rb, line 435</span>
|
432
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse_document_ruleset</span>
|
433
|
+
<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">:document</span>
|
434
|
+
<span class="ruby-identifier">scan</span>()
|
435
|
+
<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>
|
436
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-identifier">parse_error</span>(<span class="ruby-node">"'#{@value}': document requires '{'."</span>)
|
437
|
+
<span class="ruby-keyword kw">end</span>
|
438
|
+
<span class="ruby-identifier">ruleset</span> = <span class="ruby-constant">DocumentRuleset</span>.<span class="ruby-identifier">new</span>
|
439
|
+
<span class="ruby-keyword kw">while</span> <span class="ruby-ivar">@token</span>
|
440
|
+
<span class="ruby-identifier">scan</span>()
|
441
|
+
<span class="ruby-keyword kw">case</span> <span class="ruby-ivar">@token</span>
|
442
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:global</span> ; <span class="ruby-identifier">has_space?</span> ; <span class="ruby-identifier">ruleset</span>.<span class="ruby-identifier">set_global</span> <span class="ruby-identifier">_parse_list</span>()
|
443
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:local</span> ; <span class="ruby-identifier">has_space?</span> ; <span class="ruby-identifier">ruleset</span>.<span class="ruby-identifier">set_local</span> <span class="ruby-identifier">_parse_list</span>()
|
444
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:fixture</span> ; <span class="ruby-identifier">has_space?</span> ; <span class="ruby-identifier">ruleset</span>.<span class="ruby-identifier">set_fixture</span> <span class="ruby-identifier">_parse_block</span>()
|
445
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:before</span> ; <span class="ruby-identifier">has_space?</span> ; <span class="ruby-identifier">ruleset</span>.<span class="ruby-identifier">set_before</span> <span class="ruby-identifier">_parse_block</span>()
|
446
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:after</span> ; <span class="ruby-identifier">has_space?</span> ; <span class="ruby-identifier">ruleset</span>.<span class="ruby-identifier">set_after</span> <span class="ruby-identifier">_parse_block</span>()
|
447
|
+
<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>
|
448
|
+
<span class="ruby-keyword kw">else</span> ; <span class="ruby-identifier">raise</span> <span class="ruby-identifier">parse_error</span>(<span class="ruby-node">"'#{@value}': invalid token."</span>)
|
449
|
+
<span class="ruby-keyword kw">end</span>
|
450
|
+
<span class="ruby-keyword kw">end</span>
|
451
|
+
<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>
|
452
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-identifier">parse_error</span>(<span class="ruby-node">"'#{@value}': document is not closed by '}'."</span>)
|
453
|
+
<span class="ruby-keyword kw">end</span>
|
454
|
+
<span class="ruby-identifier">scan</span>()
|
455
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-constant">DocumentRuleset</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">hash</span>)
|
456
|
+
<span class="ruby-keyword kw">end</span>
|
457
|
+
</pre>
|
458
|
+
</div>
|
459
|
+
</div>
|
460
|
+
</div>
|
461
|
+
|
462
|
+
<div id="method-M000108" class="method-detail">
|
463
|
+
<a name="M000108"></a>
|
464
|
+
|
465
|
+
<div class="method-heading">
|
466
|
+
<a href="#M000108" class="method-signature">
|
467
|
+
<span class="method-name">parse_element_ruleset</span><span class="method-args">()</span>
|
468
|
+
</a>
|
469
|
+
</div>
|
470
|
+
|
471
|
+
<div class="method-description">
|
472
|
+
<p><a class="source-toggle" href="#"
|
473
|
+
onclick="toggleCode('M000108-source');return false;">[Source]</a></p>
|
474
|
+
<div class="method-source-code" id="M000108-source">
|
475
|
+
<pre>
|
476
|
+
<span class="ruby-comment cmt"># File kwartz/parser.rb, line 531</span>
|
477
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse_element_ruleset</span>
|
478
|
+
<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">:element</span>
|
479
|
+
<span class="ruby-identifier">scan</span>()
|
480
|
+
<span class="ruby-ivar">@token</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-node">"'#{@value}': element name required in string."</span>)
|
481
|
+
<span class="ruby-identifier">name</span> = <span class="ruby-ivar">@value</span>
|
482
|
+
<span class="ruby-identifier">name</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/\A\w+\z/</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">"'#{@value}': invalid element name."</span>)
|
483
|
+
<span class="ruby-identifier">scan</span>()
|
484
|
+
<span class="ruby-ivar">@token</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'{'</span><span class="ruby-value str">'{'</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">"'#{@value}': '{' required."</span>)
|
485
|
+
<span class="ruby-identifier">ruleset</span> = <span class="ruby-constant">ElementRuleset</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">name</span>)
|
486
|
+
<span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">true</span>
|
487
|
+
<span class="ruby-identifier">scan</span>()
|
488
|
+
<span class="ruby-identifier">flag_escape</span> = <span class="ruby-identifier">escape?</span>(<span class="ruby-ivar">@value</span>)
|
489
|
+
<span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@token</span>
|
490
|
+
<span class="ruby-comment cmt">#if @token.is_a?(Symbol) && (@ch != ?\ && @ch != ?\t)</span>
|
491
|
+
<span class="ruby-comment cmt"># raise parse_error("'#{@value}': following spaces are required but got '#{@ch.chr}'.")</span>
|
492
|
+
<span class="ruby-comment cmt">#end</span>
|
493
|
+
<span class="ruby-keyword kw">case</span> <span class="ruby-ivar">@token</span>
|
494
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:stag</span> ; <span class="ruby-identifier">has_space?</span> ; <span class="ruby-identifier">ruleset</span>.<span class="ruby-identifier">set_stag</span> <span class="ruby-identifier">_parse_item</span>() , <span class="ruby-identifier">flag_escape</span>
|
495
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:cont</span> ; <span class="ruby-identifier">has_space?</span> ; <span class="ruby-identifier">ruleset</span>.<span class="ruby-identifier">set_cont</span> <span class="ruby-identifier">_parse_item</span>() , <span class="ruby-identifier">flag_escape</span>
|
496
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:etag</span> ; <span class="ruby-identifier">has_space?</span> ; <span class="ruby-identifier">ruleset</span>.<span class="ruby-identifier">set_etag</span> <span class="ruby-identifier">_parse_item</span>() , <span class="ruby-identifier">flag_escape</span>
|
497
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:elem</span> ; <span class="ruby-identifier">has_space?</span> ; <span class="ruby-identifier">ruleset</span>.<span class="ruby-identifier">set_elem</span> <span class="ruby-identifier">_parse_item</span>() , <span class="ruby-identifier">flag_escape</span>
|
498
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:value</span> ; <span class="ruby-identifier">has_space?</span> ; <span class="ruby-identifier">ruleset</span>.<span class="ruby-identifier">set_value</span> <span class="ruby-identifier">_parse_item</span>() , <span class="ruby-identifier">flag_escape</span>
|
499
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:attrs</span> ; <span class="ruby-identifier">has_space?</span> ; <span class="ruby-identifier">ruleset</span>.<span class="ruby-identifier">set_attrs</span> <span class="ruby-identifier">_parse_tuples</span>() , <span class="ruby-identifier">flag_escape</span>
|
500
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:append</span> ; <span class="ruby-identifier">has_space?</span> ; <span class="ruby-identifier">ruleset</span>.<span class="ruby-identifier">set_append</span> <span class="ruby-identifier">_parse_list</span>() , <span class="ruby-identifier">flag_escape</span>
|
501
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:remove</span> ; <span class="ruby-identifier">has_space?</span> ; <span class="ruby-identifier">ruleset</span>.<span class="ruby-identifier">set_remove</span> <span class="ruby-identifier">_parse_strs</span>()
|
502
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:tagname</span> ; <span class="ruby-identifier">has_space?</span> ; <span class="ruby-identifier">ruleset</span>.<span class="ruby-identifier">set_tagname</span> <span class="ruby-identifier">_parse_str</span>()
|
503
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:logic</span> ; <span class="ruby-identifier">has_space?</span> ; <span class="ruby-identifier">ruleset</span>.<span class="ruby-identifier">set_logic</span> <span class="ruby-identifier">_parse_block</span>()
|
504
|
+
<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>
|
505
|
+
<span class="ruby-keyword kw">else</span> ; <span class="ruby-identifier">raise</span> <span class="ruby-identifier">parse_error</span>(<span class="ruby-node">"'#{@value}': invalid token."</span>)
|
506
|
+
<span class="ruby-keyword kw">end</span>
|
507
|
+
<span class="ruby-keyword kw">end</span>
|
508
|
+
<span class="ruby-identifier">assert</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">token</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'}'</span><span class="ruby-value str">'}'</span>
|
509
|
+
<span class="ruby-identifier">scan</span>()
|
510
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">ruleset</span>
|
511
|
+
<span class="ruby-keyword kw">end</span>
|
512
|
+
</pre>
|
513
|
+
</div>
|
514
|
+
</div>
|
515
|
+
</div>
|
516
|
+
|
517
|
+
<div id="method-M000098" class="method-detail">
|
518
|
+
<a name="M000098"></a>
|
519
|
+
|
520
|
+
<div class="method-heading">
|
521
|
+
<a href="#M000098" class="method-signature">
|
522
|
+
<span class="method-name">scan_hook</span><span class="method-args">()</span>
|
523
|
+
</a>
|
524
|
+
</div>
|
525
|
+
|
526
|
+
<div class="method-description">
|
527
|
+
<p><a class="source-toggle" href="#"
|
528
|
+
onclick="toggleCode('M000098-source');return false;">[Source]</a></p>
|
529
|
+
<div class="method-source-code" id="M000098-source">
|
530
|
+
<pre>
|
531
|
+
<span class="ruby-comment cmt"># File kwartz/parser.rb, line 418</span>
|
532
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">scan_hook</span>
|
533
|
+
<span class="ruby-comment cmt">## line comment</span>
|
534
|
+
<span class="ruby-identifier">c</span> = <span class="ruby-ivar">@ch</span>
|
535
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">c</span> <span class="ruby-operator">==</span> <span class="ruby-value">?#</span>
|
536
|
+
<span class="ruby-identifier">scan_line</span>
|
537
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">scan</span>()
|
538
|
+
<span class="ruby-keyword kw">end</span>
|
539
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
|
540
|
+
<span class="ruby-keyword kw">end</span>
|
541
|
+
</pre>
|
542
|
+
</div>
|
543
|
+
</div>
|
544
|
+
</div>
|
545
|
+
|
546
|
+
|
547
|
+
</div>
|
548
|
+
|
549
|
+
|
550
|
+
</div>
|
551
|
+
|
552
|
+
|
553
|
+
<div id="validator-badges">
|
554
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
555
|
+
</div>
|
556
|
+
|
557
|
+
</body>
|
558
|
+
</html>
|