danielsdeleo-teeth 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +11 -0
- data/README.rdoc +107 -10
- data/Rakefile +47 -31
- data/VERSION.yml +4 -0
- data/doc/classes/String.html +182 -0
- data/doc/classes/Teeth/DuplicateDefinitionError.html +113 -0
- data/doc/classes/Teeth/DuplicateRuleError.html +113 -0
- data/doc/classes/Teeth/InvalidDefaultDefinitionName.html +113 -0
- data/doc/classes/Teeth/InvalidExtensionDirectory.html +113 -0
- data/doc/classes/Teeth/RuleStatement.html +291 -0
- data/doc/classes/Teeth/RuleStatementGroup.html +195 -0
- data/doc/classes/Teeth/Scanner.html +535 -0
- data/doc/classes/Teeth/ScannerDefinition.html +253 -0
- data/doc/classes/Teeth/ScannerDefinitionArgumentError.html +113 -0
- data/doc/classes/Teeth/ScannerDefinitionGroup.html +269 -0
- data/doc/classes/Teeth/ScannerError.html +111 -0
- data/doc/classes/Teeth.html +129 -0
- data/doc/created.rid +1 -0
- data/doc/files/README_rdoc.html +314 -0
- data/doc/files/ext/scan_apache_logs/scan_apache_logs_yy_c.html +101 -0
- data/doc/files/ext/scan_rails_logs/scan_rails_logs_yy_c.html +101 -0
- data/doc/files/lib/rule_statement_rb.html +101 -0
- data/doc/files/lib/scanner_definition_rb.html +101 -0
- data/doc/files/lib/scanner_rb.html +108 -0
- data/doc/files/lib/teeth_rb.html +111 -0
- data/doc/fr_class_index.html +39 -0
- data/doc/fr_file_index.html +33 -0
- data/doc/fr_method_index.html +60 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/ext/scan_apache_logs/Makefile +158 -0
- data/ext/scan_apache_logs/extconf.rb +3 -0
- data/ext/scan_apache_logs/scan_apache_logs.yy +267 -0
- data/ext/scan_apache_logs/scan_apache_logs.yy.c +8355 -0
- data/ext/scan_rails_logs/Makefile +158 -0
- data/ext/scan_rails_logs/extconf.rb +3 -0
- data/ext/scan_rails_logs/scan_rails_logs.yy +376 -0
- data/ext/scan_rails_logs/scan_rails_logs.yy.c +11127 -0
- data/lib/rule_statement.rb +61 -0
- data/lib/scanner.rb +98 -0
- data/lib/scanner_definition.rb +116 -0
- data/lib/teeth.rb +5 -1
- data/scanners/scan_apache_logs.rb +27 -0
- data/scanners/scan_rails_logs.rb +70 -0
- data/spec/fixtures/rails_1x.log +59 -0
- data/spec/fixtures/rails_22.log +12 -0
- data/spec/fixtures/rails_22_cached.log +10 -0
- data/spec/fixtures/rails_unordered.log +24 -0
- data/spec/playground/show_apache_processing.rb +13 -0
- data/spec/spec_helper.rb +6 -1
- data/spec/unit/rule_statement_spec.rb +60 -0
- data/spec/unit/{tokenize_apache_spec.rb → scan_apache_spec.rb} +16 -11
- data/spec/unit/scan_rails_logs_spec.rb +90 -0
- data/spec/unit/scaner_definition_spec.rb +65 -0
- data/spec/unit/scanner_spec.rb +109 -0
- data/teeth.gemspec +31 -0
- data/templates/tokenizer.yy.erb +168 -0
- metadata +60 -15
- data/ext/extconf.rb +0 -4
- data/ext/tokenize_apache_logs.yy +0 -215
- data/ext/tokenize_apache_logs.yy.c +0 -12067
@@ -0,0 +1,253 @@
|
|
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: Teeth::ScannerDefinition</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">Teeth::ScannerDefinition</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/scanner_definition_rb.html">
|
59
|
+
lib/scanner_definition.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
|
+
Object
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
</div>
|
84
|
+
|
85
|
+
<div id="method-list">
|
86
|
+
<h3 class="section-bar">Methods</h3>
|
87
|
+
|
88
|
+
<div class="name-list">
|
89
|
+
<a href="#M000031">new</a>
|
90
|
+
<a href="#M000033">regex_to_s</a>
|
91
|
+
<a href="#M000032">scanner_code</a>
|
92
|
+
<a href="#M000034">start_condition_string</a>
|
93
|
+
</div>
|
94
|
+
</div>
|
95
|
+
|
96
|
+
</div>
|
97
|
+
|
98
|
+
|
99
|
+
<!-- if includes -->
|
100
|
+
|
101
|
+
<div id="section">
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
<div id="attribute-list">
|
108
|
+
<h3 class="section-bar">Attributes</h3>
|
109
|
+
|
110
|
+
<div class="name-list">
|
111
|
+
<table>
|
112
|
+
<tr class="top-aligned-row context-row">
|
113
|
+
<td class="context-item-name">name</td>
|
114
|
+
<td class="context-item-value"> [R] </td>
|
115
|
+
<td class="context-item-desc"></td>
|
116
|
+
</tr>
|
117
|
+
<tr class="top-aligned-row context-row">
|
118
|
+
<td class="context-item-name">regex</td>
|
119
|
+
<td class="context-item-value"> [R] </td>
|
120
|
+
<td class="context-item-desc"></td>
|
121
|
+
</tr>
|
122
|
+
</table>
|
123
|
+
</div>
|
124
|
+
</div>
|
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-M000031" class="method-detail">
|
133
|
+
<a name="M000031"></a>
|
134
|
+
|
135
|
+
<div class="method-heading">
|
136
|
+
<a href="#M000031" class="method-signature">
|
137
|
+
<span class="method-name">new</span><span class="method-args">(name, regex, opts={})</span>
|
138
|
+
</a>
|
139
|
+
</div>
|
140
|
+
|
141
|
+
<div class="method-description">
|
142
|
+
<p><a class="source-toggle" href="#"
|
143
|
+
onclick="toggleCode('M000031-source');return false;">[Source]</a></p>
|
144
|
+
<div class="method-source-code" id="M000031-source">
|
145
|
+
<pre>
|
146
|
+
<span class="ruby-comment cmt"># File lib/scanner_definition.rb, line 14</span>
|
147
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">regex</span>, <span class="ruby-identifier">opts</span>={})
|
148
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">regex</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Hash</span>)
|
149
|
+
<span class="ruby-identifier">regex</span>, <span class="ruby-identifier">opts</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">regex</span>
|
150
|
+
<span class="ruby-keyword kw">end</span>
|
151
|
+
<span class="ruby-ivar">@name</span>, <span class="ruby-ivar">@regex</span>, <span class="ruby-ivar">@start_condition</span> = <span class="ruby-identifier">name</span>, <span class="ruby-identifier">regex</span>, <span class="ruby-identifier">opts</span>[<span class="ruby-identifier">:start_condition</span>]
|
152
|
+
<span class="ruby-identifier">assert_valid_argument_combination</span>
|
153
|
+
<span class="ruby-keyword kw">end</span>
|
154
|
+
</pre>
|
155
|
+
</div>
|
156
|
+
</div>
|
157
|
+
</div>
|
158
|
+
|
159
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
160
|
+
|
161
|
+
<div id="method-M000033" class="method-detail">
|
162
|
+
<a name="M000033"></a>
|
163
|
+
|
164
|
+
<div class="method-heading">
|
165
|
+
<a href="#M000033" class="method-signature">
|
166
|
+
<span class="method-name">regex_to_s</span><span class="method-args">()</span>
|
167
|
+
</a>
|
168
|
+
</div>
|
169
|
+
|
170
|
+
<div class="method-description">
|
171
|
+
<p><a class="source-toggle" href="#"
|
172
|
+
onclick="toggleCode('M000033-source');return false;">[Source]</a></p>
|
173
|
+
<div class="method-source-code" id="M000033-source">
|
174
|
+
<pre>
|
175
|
+
<span class="ruby-comment cmt"># File lib/scanner_definition.rb, line 26</span>
|
176
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">regex_to_s</span>
|
177
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@regex</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">==</span> <span class="ruby-value str">""</span>
|
178
|
+
<span class="ruby-value str">" "</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@regex</span>.<span class="ruby-identifier">to_s</span>
|
179
|
+
<span class="ruby-keyword kw">else</span>
|
180
|
+
<span class="ruby-value str">""</span>
|
181
|
+
<span class="ruby-keyword kw">end</span>
|
182
|
+
<span class="ruby-keyword kw">end</span>
|
183
|
+
</pre>
|
184
|
+
</div>
|
185
|
+
</div>
|
186
|
+
</div>
|
187
|
+
|
188
|
+
<div id="method-M000032" class="method-detail">
|
189
|
+
<a name="M000032"></a>
|
190
|
+
|
191
|
+
<div class="method-heading">
|
192
|
+
<a href="#M000032" class="method-signature">
|
193
|
+
<span class="method-name">scanner_code</span><span class="method-args">()</span>
|
194
|
+
</a>
|
195
|
+
</div>
|
196
|
+
|
197
|
+
<div class="method-description">
|
198
|
+
<p><a class="source-toggle" href="#"
|
199
|
+
onclick="toggleCode('M000032-source');return false;">[Source]</a></p>
|
200
|
+
<div class="method-source-code" id="M000032-source">
|
201
|
+
<pre>
|
202
|
+
<span class="ruby-comment cmt"># File lib/scanner_definition.rb, line 22</span>
|
203
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">scanner_code</span>
|
204
|
+
<span class="ruby-identifier">start_condition_string</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@name</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">regex_to_s</span>
|
205
|
+
<span class="ruby-keyword kw">end</span>
|
206
|
+
</pre>
|
207
|
+
</div>
|
208
|
+
</div>
|
209
|
+
</div>
|
210
|
+
|
211
|
+
<div id="method-M000034" class="method-detail">
|
212
|
+
<a name="M000034"></a>
|
213
|
+
|
214
|
+
<div class="method-heading">
|
215
|
+
<a href="#M000034" class="method-signature">
|
216
|
+
<span class="method-name">start_condition_string</span><span class="method-args">()</span>
|
217
|
+
</a>
|
218
|
+
</div>
|
219
|
+
|
220
|
+
<div class="method-description">
|
221
|
+
<p><a class="source-toggle" href="#"
|
222
|
+
onclick="toggleCode('M000034-source');return false;">[Source]</a></p>
|
223
|
+
<div class="method-source-code" id="M000034-source">
|
224
|
+
<pre>
|
225
|
+
<span class="ruby-comment cmt"># File lib/scanner_definition.rb, line 34</span>
|
226
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">start_condition_string</span>
|
227
|
+
<span class="ruby-keyword kw">case</span> <span class="ruby-ivar">@start_condition</span>.<span class="ruby-identifier">to_s</span>
|
228
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">/^inc/</span>
|
229
|
+
<span class="ruby-value str">"%s "</span>
|
230
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-regexp re">/^exc/</span>
|
231
|
+
<span class="ruby-value str">"%x "</span>
|
232
|
+
<span class="ruby-keyword kw">else</span>
|
233
|
+
<span class="ruby-value str">""</span>
|
234
|
+
<span class="ruby-keyword kw">end</span>
|
235
|
+
<span class="ruby-keyword kw">end</span>
|
236
|
+
</pre>
|
237
|
+
</div>
|
238
|
+
</div>
|
239
|
+
</div>
|
240
|
+
|
241
|
+
|
242
|
+
</div>
|
243
|
+
|
244
|
+
|
245
|
+
</div>
|
246
|
+
|
247
|
+
|
248
|
+
<div id="validator-badges">
|
249
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
250
|
+
</div>
|
251
|
+
|
252
|
+
</body>
|
253
|
+
</html>
|
@@ -0,0 +1,113 @@
|
|
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: Teeth::ScannerDefinitionArgumentError</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">Teeth::ScannerDefinitionArgumentError</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/scanner_definition_rb.html">
|
59
|
+
lib/scanner_definition.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="ScannerError.html">
|
69
|
+
ScannerError
|
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
|
+
|
84
|
+
|
85
|
+
</div>
|
86
|
+
|
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
|
+
|
104
|
+
|
105
|
+
</div>
|
106
|
+
|
107
|
+
|
108
|
+
<div id="validator-badges">
|
109
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
110
|
+
</div>
|
111
|
+
|
112
|
+
</body>
|
113
|
+
</html>
|
@@ -0,0 +1,269 @@
|
|
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: Teeth::ScannerDefinitionGroup</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">Teeth::ScannerDefinitionGroup</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/scanner_definition_rb.html">
|
59
|
+
lib/scanner_definition.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
|
+
Array
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
</div>
|
84
|
+
|
85
|
+
<div id="method-list">
|
86
|
+
<h3 class="section-bar">Methods</h3>
|
87
|
+
|
88
|
+
<div class="name-list">
|
89
|
+
<a href="#M000018">add</a>
|
90
|
+
<a href="#M000019">assert_defn_has_unique_name</a>
|
91
|
+
<a href="#M000022">defaults_for</a>
|
92
|
+
<a href="#M000020">defn_names</a>
|
93
|
+
<a href="#M000021">method_missing</a>
|
94
|
+
</div>
|
95
|
+
</div>
|
96
|
+
|
97
|
+
</div>
|
98
|
+
|
99
|
+
|
100
|
+
<!-- if includes -->
|
101
|
+
|
102
|
+
<div id="section">
|
103
|
+
|
104
|
+
|
105
|
+
<div id="constants-list">
|
106
|
+
<h3 class="section-bar">Constants</h3>
|
107
|
+
|
108
|
+
<div class="name-list">
|
109
|
+
<table summary="Constants">
|
110
|
+
<tr class="top-aligned-row context-row">
|
111
|
+
<td class="context-item-name">DEFAULT_DEFINITIONS</td>
|
112
|
+
<td>=</td>
|
113
|
+
<td class="context-item-value">{}</td>
|
114
|
+
</tr>
|
115
|
+
</table>
|
116
|
+
</div>
|
117
|
+
</div>
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
<!-- if method_list -->
|
125
|
+
<div id="methods">
|
126
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
127
|
+
|
128
|
+
<div id="method-M000018" class="method-detail">
|
129
|
+
<a name="M000018"></a>
|
130
|
+
|
131
|
+
<div class="method-heading">
|
132
|
+
<a href="#M000018" class="method-signature">
|
133
|
+
<span class="method-name">add</span><span class="method-args">(name, regex, options={})</span>
|
134
|
+
</a>
|
135
|
+
</div>
|
136
|
+
|
137
|
+
<div class="method-description">
|
138
|
+
<p><a class="source-toggle" href="#"
|
139
|
+
onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
|
140
|
+
<div class="method-source-code" id="M000018-source">
|
141
|
+
<pre>
|
142
|
+
<span class="ruby-comment cmt"># File lib/scanner_definition.rb, line 80</span>
|
143
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">regex</span>, <span class="ruby-identifier">options</span>={})
|
144
|
+
<span class="ruby-identifier">assert_defn_has_unique_name</span>(<span class="ruby-identifier">name</span>)
|
145
|
+
<span class="ruby-identifier">push</span> <span class="ruby-constant">ScannerDefinition</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">regex</span>, <span class="ruby-identifier">options</span>)
|
146
|
+
<span class="ruby-keyword kw">end</span>
|
147
|
+
</pre>
|
148
|
+
</div>
|
149
|
+
</div>
|
150
|
+
</div>
|
151
|
+
|
152
|
+
<div id="method-M000019" class="method-detail">
|
153
|
+
<a name="M000019"></a>
|
154
|
+
|
155
|
+
<div class="method-heading">
|
156
|
+
<a href="#M000019" class="method-signature">
|
157
|
+
<span class="method-name">assert_defn_has_unique_name</span><span class="method-args">(name)</span>
|
158
|
+
</a>
|
159
|
+
</div>
|
160
|
+
|
161
|
+
<div class="method-description">
|
162
|
+
<p><a class="source-toggle" href="#"
|
163
|
+
onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
|
164
|
+
<div class="method-source-code" id="M000019-source">
|
165
|
+
<pre>
|
166
|
+
<span class="ruby-comment cmt"># File lib/scanner_definition.rb, line 85</span>
|
167
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">assert_defn_has_unique_name</span>(<span class="ruby-identifier">name</span>)
|
168
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">defn_names</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>)
|
169
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">DuplicateDefinitionError</span>, <span class="ruby-node">"a definition for #{name.to_s} has already been defined"</span>
|
170
|
+
<span class="ruby-keyword kw">end</span>
|
171
|
+
<span class="ruby-keyword kw">end</span>
|
172
|
+
</pre>
|
173
|
+
</div>
|
174
|
+
</div>
|
175
|
+
</div>
|
176
|
+
|
177
|
+
<div id="method-M000022" class="method-detail">
|
178
|
+
<a name="M000022"></a>
|
179
|
+
|
180
|
+
<div class="method-heading">
|
181
|
+
<a href="#M000022" class="method-signature">
|
182
|
+
<span class="method-name">defaults_for</span><span class="method-args">(*default_types)</span>
|
183
|
+
</a>
|
184
|
+
</div>
|
185
|
+
|
186
|
+
<div class="method-description">
|
187
|
+
<p><a class="source-toggle" href="#"
|
188
|
+
onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
|
189
|
+
<div class="method-source-code" id="M000022-source">
|
190
|
+
<pre>
|
191
|
+
<span class="ruby-comment cmt"># File lib/scanner_definition.rb, line 100</span>
|
192
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">defaults_for</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">default_types</span>)
|
193
|
+
<span class="ruby-identifier">default_types</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">default_type</span><span class="ruby-operator">|</span>
|
194
|
+
<span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">default_definitions</span> = <span class="ruby-constant">DEFAULT_DEFINITIONS</span>[<span class="ruby-identifier">default_type</span>]
|
195
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidDefaultDefinitionName</span>, <span class="ruby-node">"no default definitions found for #{default_type.to_s}"</span>
|
196
|
+
<span class="ruby-keyword kw">end</span>
|
197
|
+
<span class="ruby-identifier">default_definitions</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">defn</span><span class="ruby-operator">|</span>
|
198
|
+
<span class="ruby-keyword kw">begin</span>
|
199
|
+
<span class="ruby-identifier">add</span>(<span class="ruby-identifier">defn</span>.<span class="ruby-identifier">first</span>, <span class="ruby-identifier">defn</span>.<span class="ruby-identifier">last</span>)
|
200
|
+
<span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">DuplicateDefinitionError</span>
|
201
|
+
<span class="ruby-keyword kw">end</span>
|
202
|
+
<span class="ruby-keyword kw">end</span>
|
203
|
+
<span class="ruby-keyword kw">end</span>
|
204
|
+
<span class="ruby-keyword kw">end</span>
|
205
|
+
</pre>
|
206
|
+
</div>
|
207
|
+
</div>
|
208
|
+
</div>
|
209
|
+
|
210
|
+
<div id="method-M000020" class="method-detail">
|
211
|
+
<a name="M000020"></a>
|
212
|
+
|
213
|
+
<div class="method-heading">
|
214
|
+
<a href="#M000020" class="method-signature">
|
215
|
+
<span class="method-name">defn_names</span><span class="method-args">()</span>
|
216
|
+
</a>
|
217
|
+
</div>
|
218
|
+
|
219
|
+
<div class="method-description">
|
220
|
+
<p><a class="source-toggle" href="#"
|
221
|
+
onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
|
222
|
+
<div class="method-source-code" id="M000020-source">
|
223
|
+
<pre>
|
224
|
+
<span class="ruby-comment cmt"># File lib/scanner_definition.rb, line 91</span>
|
225
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">defn_names</span>
|
226
|
+
<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">defn_statement</span><span class="ruby-operator">|</span> <span class="ruby-identifier">defn_statement</span>.<span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span> }
|
227
|
+
<span class="ruby-keyword kw">end</span>
|
228
|
+
</pre>
|
229
|
+
</div>
|
230
|
+
</div>
|
231
|
+
</div>
|
232
|
+
|
233
|
+
<div id="method-M000021" class="method-detail">
|
234
|
+
<a name="M000021"></a>
|
235
|
+
|
236
|
+
<div class="method-heading">
|
237
|
+
<a href="#M000021" class="method-signature">
|
238
|
+
<span class="method-name">method_missing</span><span class="method-args">(called_method_name, *args, &block)</span>
|
239
|
+
</a>
|
240
|
+
</div>
|
241
|
+
|
242
|
+
<div class="method-description">
|
243
|
+
<p><a class="source-toggle" href="#"
|
244
|
+
onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
|
245
|
+
<div class="method-source-code" id="M000021-source">
|
246
|
+
<pre>
|
247
|
+
<span class="ruby-comment cmt"># File lib/scanner_definition.rb, line 95</span>
|
248
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">method_missing</span>(<span class="ruby-identifier">called_method_name</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
249
|
+
<span class="ruby-identifier">args</span>[<span class="ruby-value">1</span>] <span class="ruby-operator">||=</span>{}
|
250
|
+
<span class="ruby-identifier">add</span>(<span class="ruby-identifier">called_method_name</span>, <span class="ruby-identifier">args</span>[<span class="ruby-value">0</span>], <span class="ruby-identifier">args</span>[<span class="ruby-value">1</span>])
|
251
|
+
<span class="ruby-keyword kw">end</span>
|
252
|
+
</pre>
|
253
|
+
</div>
|
254
|
+
</div>
|
255
|
+
</div>
|
256
|
+
|
257
|
+
|
258
|
+
</div>
|
259
|
+
|
260
|
+
|
261
|
+
</div>
|
262
|
+
|
263
|
+
|
264
|
+
<div id="validator-badges">
|
265
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
266
|
+
</div>
|
267
|
+
|
268
|
+
</body>
|
269
|
+
</html>
|