ruby-json 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/COPYING +504 -0
- data/README +16 -0
- data/doc/classes/Array.html +162 -0
- data/doc/classes/Array.src/M000011.html +27 -0
- data/doc/classes/Array.src/M000012.html +32 -0
- data/doc/classes/ArrayTest.html +129 -0
- data/doc/classes/ArrayTest.src/M000014.html +28 -0
- data/doc/classes/FalseClass.html +131 -0
- data/doc/classes/FalseClass.src/M000013.html +18 -0
- data/doc/classes/Hash.html +156 -0
- data/doc/classes/Hash.src/M000009.html +29 -0
- data/doc/classes/Hash.src/M000010.html +45 -0
- data/doc/classes/JSON.html +103 -0
- data/doc/classes/JSON/Lexer.html +411 -0
- data/doc/classes/JSON/Lexer.src/M000022.html +19 -0
- data/doc/classes/JSON/Lexer.src/M000023.html +18 -0
- data/doc/classes/JSON/Lexer.src/M000024.html +18 -0
- data/doc/classes/JSON/Lexer.src/M000025.html +20 -0
- data/doc/classes/JSON/Lexer.src/M000026.html +20 -0
- data/doc/classes/JSON/Lexer.src/M000027.html +21 -0
- data/doc/classes/JSON/Lexer.src/M000028.html +43 -0
- data/doc/classes/JSON/Lexer.src/M000029.html +67 -0
- data/doc/classes/JSON/Lexer.src/M000030.html +46 -0
- data/doc/classes/JSON/Lexer.src/M000031.html +26 -0
- data/doc/classes/JSON/Lexer.src/M000032.html +61 -0
- data/doc/classes/JSON/Lexer.src/M000033.html +29 -0
- data/doc/classes/JSON/Lexer.src/M000034.html +18 -0
- data/doc/classes/JSON/Lexer.src/M000035.html +19 -0
- data/doc/classes/JSON/Lexer.src/M000036.html +20 -0
- data/doc/classes/LexerTest.html +219 -0
- data/doc/classes/LexerTest.src/M000002.html +24 -0
- data/doc/classes/LexerTest.src/M000003.html +22 -0
- data/doc/classes/LexerTest.src/M000004.html +26 -0
- data/doc/classes/LexerTest.src/M000005.html +23 -0
- data/doc/classes/LexerTest.src/M000006.html +31 -0
- data/doc/classes/LexerTest.src/M000007.html +27 -0
- data/doc/classes/LexerTest.src/M000008.html +58 -0
- data/doc/classes/NilClass.html +131 -0
- data/doc/classes/NilClass.src/M000017.html +18 -0
- data/doc/classes/Numeric.html +131 -0
- data/doc/classes/Numeric.src/M000016.html +18 -0
- data/doc/classes/Object.html +176 -0
- data/doc/classes/Object.src/M000018.html +18 -0
- data/doc/classes/ObjectTest.html +129 -0
- data/doc/classes/ObjectTest.src/M000015.html +28 -0
- data/doc/classes/String.html +151 -0
- data/doc/classes/String.src/M000019.html +18 -0
- data/doc/classes/String.src/M000020.html +46 -0
- data/doc/classes/TrueClass.html +131 -0
- data/doc/classes/TrueClass.src/M000021.html +18 -0
- data/doc/created.rid +1 -0
- data/doc/files/install_rb.html +194 -0
- data/doc/files/install_rb.src/M000001.html +43 -0
- data/doc/files/json/lexer_rb.html +156 -0
- data/doc/files/json/objects_rb.html +154 -0
- data/doc/files/test/arraytest_rb.html +150 -0
- data/doc/files/test/lexertest_rb.html +150 -0
- data/doc/files/test/objtest_rb.html +150 -0
- data/doc/fr_class_index.html +39 -0
- data/doc/fr_file_index.html +32 -0
- data/doc/fr_method_index.html +62 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +175 -0
- data/install.rb +67 -0
- data/lib/json/lexer.rb +297 -0
- data/lib/json/objects.rb +201 -0
- data/ruby-json.gemspec +25 -0
- data/test/arraytest.rb +45 -0
- data/test/lexertest.rb +146 -0
- data/test/objtest.rb +45 -0
- metadata +126 -0
@@ -0,0 +1,18 @@
|
|
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>
|
7
|
+
<head>
|
8
|
+
<title>to_json (FalseClass)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File json/objects.rb, line 48</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_json</span>
|
15
|
+
<span class="ruby-value str">"false"</span>
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,156 @@
|
|
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: Hash</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
|
+
<h1>Hash <sup class="type-note">(Class)</sup></h1>
|
51
|
+
<table class="header-table">
|
52
|
+
<tr class="top-aligned-row">
|
53
|
+
<td><strong>In:</strong></td>
|
54
|
+
<td>
|
55
|
+
<a href="../files/json/objects_rb.html">
|
56
|
+
json/objects.rb
|
57
|
+
</a>
|
58
|
+
<br />
|
59
|
+
</td>
|
60
|
+
</tr>
|
61
|
+
|
62
|
+
<tr class="top-aligned-row">
|
63
|
+
<td><strong>Parent:</strong></td>
|
64
|
+
<td>
|
65
|
+
<a href="Object.html">
|
66
|
+
Object
|
67
|
+
</a>
|
68
|
+
</td>
|
69
|
+
</tr>
|
70
|
+
</table>
|
71
|
+
</div>
|
72
|
+
<!-- banner header -->
|
73
|
+
|
74
|
+
<div id="bodyContent">
|
75
|
+
|
76
|
+
|
77
|
+
<div id="contextContent">
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<div id="method-list">
|
82
|
+
<h2 class="section-bar">Methods</h2>
|
83
|
+
|
84
|
+
<div class="name-list">
|
85
|
+
<a href="#M000010">from_json</a>
|
86
|
+
<a href="#M000009">to_json</a>
|
87
|
+
</div>
|
88
|
+
</div>
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
</div>
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
<!-- if includes -->
|
100
|
+
|
101
|
+
|
102
|
+
<!-- if method_list -->
|
103
|
+
<div id="methods">
|
104
|
+
<h2 class="section-bar">Public Instance methods</h2>
|
105
|
+
|
106
|
+
<div id="method-M000010" class="method-detail">
|
107
|
+
<a name="M000010"></a>
|
108
|
+
|
109
|
+
<div class="method-heading">
|
110
|
+
<a href="Hash.src/M000010.html" target="Code" class="method-signature"
|
111
|
+
onclick="popupCode('Hash.src/M000010.html');return false;">
|
112
|
+
<span class="method-name">from_json</span><span class="method-args">(lexer)</span>
|
113
|
+
</a>
|
114
|
+
</div>
|
115
|
+
|
116
|
+
<div class="method-description">
|
117
|
+
<p>
|
118
|
+
This method will parse a JSON object from the passed lexer object. It takes
|
119
|
+
a lexer object which is about to read a JSON object. It raises a runtime
|
120
|
+
error otherwise. It returns the original JSON object. This method probably
|
121
|
+
shouldn’t be used directly.
|
122
|
+
</p>
|
123
|
+
<h5>Parameters</h5>
|
124
|
+
</div>
|
125
|
+
</div>
|
126
|
+
|
127
|
+
<div id="method-M000009" class="method-detail">
|
128
|
+
<a name="M000009"></a>
|
129
|
+
|
130
|
+
<div class="method-heading">
|
131
|
+
<a href="Hash.src/M000009.html" target="Code" class="method-signature"
|
132
|
+
onclick="popupCode('Hash.src/M000009.html');return false;">
|
133
|
+
<span class="method-name">to_json</span><span class="method-args">()</span>
|
134
|
+
</a>
|
135
|
+
</div>
|
136
|
+
|
137
|
+
<div class="method-description">
|
138
|
+
<p>
|
139
|
+
This method will serialize the hash into regular JSON format.
|
140
|
+
</p>
|
141
|
+
</div>
|
142
|
+
</div>
|
143
|
+
|
144
|
+
|
145
|
+
</div>
|
146
|
+
|
147
|
+
|
148
|
+
</div>
|
149
|
+
|
150
|
+
|
151
|
+
<div id="validator-badges">
|
152
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
153
|
+
</div>
|
154
|
+
|
155
|
+
</body>
|
156
|
+
</html>
|
@@ -0,0 +1,29 @@
|
|
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>
|
7
|
+
<head>
|
8
|
+
<title>to_json (Hash)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File json/objects.rb, line 148</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_json</span>
|
15
|
+
<span class="ruby-identifier">retval</span> = <span class="ruby-value str">"{"</span>
|
16
|
+
|
17
|
+
<span class="ruby-identifier">first</span> = <span class="ruby-keyword kw">true</span>
|
18
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">val</span><span class="ruby-operator">|</span>
|
19
|
+
<span class="ruby-identifier">retval</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">","</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">first</span>
|
20
|
+
<span class="ruby-identifier">key</span> = <span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-comment cmt">#keys in json hashes need to be strings, nothing else.</span>
|
21
|
+
<span class="ruby-identifier">retval</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_json</span> <span class="ruby-operator">+</span> <span class="ruby-value str">":"</span>
|
22
|
+
<span class="ruby-identifier">retval</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">val</span>.<span class="ruby-identifier">to_json</span>
|
23
|
+
<span class="ruby-identifier">first</span> = <span class="ruby-keyword kw">false</span>
|
24
|
+
}
|
25
|
+
<span class="ruby-identifier">retval</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"}"</span>
|
26
|
+
<span class="ruby-keyword kw">return</span>(<span class="ruby-identifier">retval</span>)
|
27
|
+
<span class="ruby-keyword kw">end</span></pre>
|
28
|
+
</body>
|
29
|
+
</html>
|
@@ -0,0 +1,45 @@
|
|
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>
|
7
|
+
<head>
|
8
|
+
<title>from_json (Hash)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File json/objects.rb, line 169</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">from_json</span>(<span class="ruby-identifier">lexer</span>)
|
15
|
+
<span class="ruby-identifier">lexer</span>.<span class="ruby-identifier">unescape</span> <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">lexer</span>.<span class="ruby-identifier">nextclean</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'%'</span>)
|
16
|
+
<span class="ruby-identifier">lexer</span>.<span class="ruby-identifier">back</span>
|
17
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-value str">"A JSON Object must begin with '{'"</span> <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">lexer</span>.<span class="ruby-identifier">nextclean</span> <span class="ruby-operator">!=</span> <span class="ruby-value str">"{"</span>)
|
18
|
+
<span class="ruby-identifier">loop</span> {
|
19
|
+
<span class="ruby-identifier">c</span> = <span class="ruby-identifier">lexer</span>.<span class="ruby-identifier">nextclean</span>
|
20
|
+
<span class="ruby-identifier">key</span> = <span class="ruby-keyword kw">nil</span>
|
21
|
+
<span class="ruby-keyword kw">case</span> <span class="ruby-identifier">c</span>
|
22
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">'\0'</span>
|
23
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-value str">"A JSON Object must end with '}'"</span>
|
24
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">'}'</span>
|
25
|
+
<span class="ruby-keyword kw">return</span>;
|
26
|
+
<span class="ruby-keyword kw">else</span>
|
27
|
+
<span class="ruby-identifier">lexer</span>.<span class="ruby-identifier">back</span>
|
28
|
+
<span class="ruby-identifier">key</span> = <span class="ruby-identifier">lexer</span>.<span class="ruby-identifier">nextvalue</span>().<span class="ruby-identifier">to_s</span>()
|
29
|
+
<span class="ruby-keyword kw">end</span>
|
30
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-value str">"Expected a ':' after a key"</span> <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">lexer</span>.<span class="ruby-identifier">nextclean</span>() <span class="ruby-operator">!=</span> <span class="ruby-value str">':'</span>)
|
31
|
+
<span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">lexer</span>.<span class="ruby-identifier">nextvalue</span>()
|
32
|
+
<span class="ruby-keyword kw">case</span> <span class="ruby-identifier">lexer</span>.<span class="ruby-identifier">nextclean</span>()
|
33
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">','</span>
|
34
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">lexer</span>.<span class="ruby-identifier">nextclean</span>() <span class="ruby-operator">==</span> <span class="ruby-value str">'}'</span>)
|
35
|
+
<span class="ruby-identifier">lexer</span>.<span class="ruby-identifier">back</span>
|
36
|
+
<span class="ruby-keyword kw">when</span> <span class="ruby-value str">'}'</span>
|
37
|
+
<span class="ruby-keyword kw">return</span>(<span class="ruby-keyword kw">self</span>)
|
38
|
+
<span class="ruby-keyword kw">else</span>
|
39
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-value str">"Expected a ',' or '}'"</span>
|
40
|
+
<span class="ruby-keyword kw">end</span>
|
41
|
+
}
|
42
|
+
<span class="ruby-keyword kw">return</span>(<span class="ruby-keyword kw">self</span>)
|
43
|
+
<span class="ruby-keyword kw">end</span></pre>
|
44
|
+
</body>
|
45
|
+
</html>
|
@@ -0,0 +1,103 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Module: JSON</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
|
+
<h1>JSON <sup class="type-note">(Module)</sup></h1>
|
51
|
+
<table class="header-table">
|
52
|
+
<tr class="top-aligned-row">
|
53
|
+
<td><strong>In:</strong></td>
|
54
|
+
<td>
|
55
|
+
<a href="../files/json/lexer_rb.html">
|
56
|
+
json/lexer.rb
|
57
|
+
</a>
|
58
|
+
<br />
|
59
|
+
</td>
|
60
|
+
</tr>
|
61
|
+
|
62
|
+
</table>
|
63
|
+
</div>
|
64
|
+
<!-- banner header -->
|
65
|
+
|
66
|
+
<div id="bodyContent">
|
67
|
+
|
68
|
+
|
69
|
+
<div id="contextContent">
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
<div id="class-list">
|
79
|
+
<h2 class="section-bar">Classes and Modules</h2>
|
80
|
+
|
81
|
+
Class <a href="JSON/Lexer.html" class="link">JSON::Lexer</a><br />
|
82
|
+
|
83
|
+
</div>
|
84
|
+
|
85
|
+
</div>
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
<!-- if includes -->
|
90
|
+
|
91
|
+
|
92
|
+
<!-- if method_list -->
|
93
|
+
|
94
|
+
|
95
|
+
</div>
|
96
|
+
|
97
|
+
|
98
|
+
<div id="validator-badges">
|
99
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
100
|
+
</div>
|
101
|
+
|
102
|
+
</body>
|
103
|
+
</html>
|
@@ -0,0 +1,411 @@
|
|
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: JSON::Lexer</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
|
+
<h1>JSON::Lexer <sup class="type-note">(Class)</sup></h1>
|
51
|
+
<table class="header-table">
|
52
|
+
<tr class="top-aligned-row">
|
53
|
+
<td><strong>In:</strong></td>
|
54
|
+
<td>
|
55
|
+
<a href="../../files/json/lexer_rb.html">
|
56
|
+
json/lexer.rb
|
57
|
+
</a>
|
58
|
+
<br />
|
59
|
+
</td>
|
60
|
+
</tr>
|
61
|
+
|
62
|
+
<tr class="top-aligned-row">
|
63
|
+
<td><strong>Parent:</strong></td>
|
64
|
+
<td>
|
65
|
+
<a href="../Object.html">
|
66
|
+
Object
|
67
|
+
</a>
|
68
|
+
</td>
|
69
|
+
</tr>
|
70
|
+
</table>
|
71
|
+
</div>
|
72
|
+
<!-- banner header -->
|
73
|
+
|
74
|
+
<div id="bodyContent">
|
75
|
+
|
76
|
+
|
77
|
+
<div id="contextContent">
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<div id="method-list">
|
82
|
+
<h2 class="section-bar">Methods</h2>
|
83
|
+
|
84
|
+
<div class="name-list">
|
85
|
+
<a href="#M000023">back</a>
|
86
|
+
<a href="#M000036">each</a>
|
87
|
+
<a href="#M000024">more?</a>
|
88
|
+
<a href="#M000022">new</a>
|
89
|
+
<a href="#M000025">nextchar</a>
|
90
|
+
<a href="#M000027">nextchars</a>
|
91
|
+
<a href="#M000028">nextclean</a>
|
92
|
+
<a href="#M000026">nextmatch</a>
|
93
|
+
<a href="#M000030">nextstring</a>
|
94
|
+
<a href="#M000031">nextto</a>
|
95
|
+
<a href="#M000032">nextvalue</a>
|
96
|
+
<a href="#M000035">skippast</a>
|
97
|
+
<a href="#M000033">skipto</a>
|
98
|
+
<a href="#M000034">unescape</a>
|
99
|
+
<a href="#M000029">utf8str</a>
|
100
|
+
</div>
|
101
|
+
</div>
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
</div>
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
<!-- if includes -->
|
113
|
+
|
114
|
+
|
115
|
+
<!-- if method_list -->
|
116
|
+
<div id="methods">
|
117
|
+
<h2 class="section-bar">Public Class methods</h2>
|
118
|
+
|
119
|
+
<div id="method-M000022" class="method-detail">
|
120
|
+
<a name="M000022"></a>
|
121
|
+
|
122
|
+
<div class="method-heading">
|
123
|
+
<a href="Lexer.src/M000022.html" target="Code" class="method-signature"
|
124
|
+
onclick="popupCode('Lexer.src/M000022.html');return false;">
|
125
|
+
<span class="method-name">new</span><span class="method-args">(s)</span>
|
126
|
+
</a>
|
127
|
+
</div>
|
128
|
+
|
129
|
+
<div class="method-description">
|
130
|
+
<p>
|
131
|
+
This method will initialize the lexer to contain a string.
|
132
|
+
</p>
|
133
|
+
<h5>Parameters</h5>
|
134
|
+
<table>
|
135
|
+
<tr><td valign="top"><tt>s</tt>:</td><td>the string to initialize the lexer object with
|
136
|
+
|
137
|
+
</td></tr>
|
138
|
+
</table>
|
139
|
+
</div>
|
140
|
+
</div>
|
141
|
+
|
142
|
+
<h2 class="section-bar">Public Instance methods</h2>
|
143
|
+
|
144
|
+
<div id="method-M000023" class="method-detail">
|
145
|
+
<a name="M000023"></a>
|
146
|
+
|
147
|
+
<div class="method-heading">
|
148
|
+
<a href="Lexer.src/M000023.html" target="Code" class="method-signature"
|
149
|
+
onclick="popupCode('Lexer.src/M000023.html');return false;">
|
150
|
+
<span class="method-name">back</span><span class="method-args">()</span>
|
151
|
+
</a>
|
152
|
+
</div>
|
153
|
+
|
154
|
+
<div class="method-description">
|
155
|
+
<p>
|
156
|
+
Backs up the lexer status one character.
|
157
|
+
</p>
|
158
|
+
</div>
|
159
|
+
</div>
|
160
|
+
|
161
|
+
<div id="method-M000036" class="method-detail">
|
162
|
+
<a name="M000036"></a>
|
163
|
+
|
164
|
+
<div class="method-heading">
|
165
|
+
<a href="Lexer.src/M000036.html" target="Code" class="method-signature"
|
166
|
+
onclick="popupCode('Lexer.src/M000036.html');return false;">
|
167
|
+
<span class="method-name">each</span><span class="method-args">() {|n| ...}</span>
|
168
|
+
</a>
|
169
|
+
</div>
|
170
|
+
|
171
|
+
<div class="method-description">
|
172
|
+
</div>
|
173
|
+
</div>
|
174
|
+
|
175
|
+
<div id="method-M000024" class="method-detail">
|
176
|
+
<a name="M000024"></a>
|
177
|
+
|
178
|
+
<div class="method-heading">
|
179
|
+
<a href="Lexer.src/M000024.html" target="Code" class="method-signature"
|
180
|
+
onclick="popupCode('Lexer.src/M000024.html');return false;">
|
181
|
+
<span class="method-name">more?</span><span class="method-args">()</span>
|
182
|
+
</a>
|
183
|
+
</div>
|
184
|
+
|
185
|
+
<div class="method-description">
|
186
|
+
</div>
|
187
|
+
</div>
|
188
|
+
|
189
|
+
<div id="method-M000025" class="method-detail">
|
190
|
+
<a name="M000025"></a>
|
191
|
+
|
192
|
+
<div class="method-heading">
|
193
|
+
<a href="Lexer.src/M000025.html" target="Code" class="method-signature"
|
194
|
+
onclick="popupCode('Lexer.src/M000025.html');return false;">
|
195
|
+
<span class="method-name">nextchar</span><span class="method-args">()</span>
|
196
|
+
</a>
|
197
|
+
</div>
|
198
|
+
|
199
|
+
<div class="method-description">
|
200
|
+
<p>
|
201
|
+
Consumes the next character.
|
202
|
+
</p>
|
203
|
+
</div>
|
204
|
+
</div>
|
205
|
+
|
206
|
+
<div id="method-M000027" class="method-detail">
|
207
|
+
<a name="M000027"></a>
|
208
|
+
|
209
|
+
<div class="method-heading">
|
210
|
+
<a href="Lexer.src/M000027.html" target="Code" class="method-signature"
|
211
|
+
onclick="popupCode('Lexer.src/M000027.html');return false;">
|
212
|
+
<span class="method-name">nextchars</span><span class="method-args">(n)</span>
|
213
|
+
</a>
|
214
|
+
</div>
|
215
|
+
|
216
|
+
<div class="method-description">
|
217
|
+
<p>
|
218
|
+
Read the next n characters from the string in the lexer.
|
219
|
+
</p>
|
220
|
+
<h5>Parameters</h5>
|
221
|
+
<table>
|
222
|
+
<tr><td valign="top"><tt>n</tt>:</td><td>the number of characters to read from the lexer
|
223
|
+
|
224
|
+
</td></tr>
|
225
|
+
</table>
|
226
|
+
</div>
|
227
|
+
</div>
|
228
|
+
|
229
|
+
<div id="method-M000028" class="method-detail">
|
230
|
+
<a name="M000028"></a>
|
231
|
+
|
232
|
+
<div class="method-heading">
|
233
|
+
<a href="Lexer.src/M000028.html" target="Code" class="method-signature"
|
234
|
+
onclick="popupCode('Lexer.src/M000028.html');return false;">
|
235
|
+
<span class="method-name">nextclean</span><span class="method-args">()</span>
|
236
|
+
</a>
|
237
|
+
</div>
|
238
|
+
|
239
|
+
<div class="method-description">
|
240
|
+
<p>
|
241
|
+
Read the next n characters from the string with escape sequence processing.
|
242
|
+
</p>
|
243
|
+
</div>
|
244
|
+
</div>
|
245
|
+
|
246
|
+
<div id="method-M000026" class="method-detail">
|
247
|
+
<a name="M000026"></a>
|
248
|
+
|
249
|
+
<div class="method-heading">
|
250
|
+
<a href="Lexer.src/M000026.html" target="Code" class="method-signature"
|
251
|
+
onclick="popupCode('Lexer.src/M000026.html');return false;">
|
252
|
+
<span class="method-name">nextmatch</span><span class="method-args">(char)</span>
|
253
|
+
</a>
|
254
|
+
</div>
|
255
|
+
|
256
|
+
<div class="method-description">
|
257
|
+
<p>
|
258
|
+
Consumes the next character and check that it matches a specified
|
259
|
+
character.
|
260
|
+
</p>
|
261
|
+
</div>
|
262
|
+
</div>
|
263
|
+
|
264
|
+
<div id="method-M000030" class="method-detail">
|
265
|
+
<a name="M000030"></a>
|
266
|
+
|
267
|
+
<div class="method-heading">
|
268
|
+
<a href="Lexer.src/M000030.html" target="Code" class="method-signature"
|
269
|
+
onclick="popupCode('Lexer.src/M000030.html');return false;">
|
270
|
+
<span class="method-name">nextstring</span><span class="method-args">(quot)</span>
|
271
|
+
</a>
|
272
|
+
</div>
|
273
|
+
|
274
|
+
<div class="method-description">
|
275
|
+
<p>
|
276
|
+
Reads the next string, given a quote character (usually ’ or ")
|
277
|
+
</p>
|
278
|
+
<h5>Parameters</h5>
|
279
|
+
<p>
|
280
|
+
<tt>quot</tt>: the next matching quote character to use
|
281
|
+
</p>
|
282
|
+
</div>
|
283
|
+
</div>
|
284
|
+
|
285
|
+
<div id="method-M000031" class="method-detail">
|
286
|
+
<a name="M000031"></a>
|
287
|
+
|
288
|
+
<div class="method-heading">
|
289
|
+
<a href="Lexer.src/M000031.html" target="Code" class="method-signature"
|
290
|
+
onclick="popupCode('Lexer.src/M000031.html');return false;">
|
291
|
+
<span class="method-name">nextto</span><span class="method-args">(regex)</span>
|
292
|
+
</a>
|
293
|
+
</div>
|
294
|
+
|
295
|
+
<div class="method-description">
|
296
|
+
<p>
|
297
|
+
Reads the next group of characters that match a regular expresion.
|
298
|
+
</p>
|
299
|
+
</div>
|
300
|
+
</div>
|
301
|
+
|
302
|
+
<div id="method-M000032" class="method-detail">
|
303
|
+
<a name="M000032"></a>
|
304
|
+
|
305
|
+
<div class="method-heading">
|
306
|
+
<a href="Lexer.src/M000032.html" target="Code" class="method-signature"
|
307
|
+
onclick="popupCode('Lexer.src/M000032.html');return false;">
|
308
|
+
<span class="method-name">nextvalue</span><span class="method-args">()</span>
|
309
|
+
</a>
|
310
|
+
</div>
|
311
|
+
|
312
|
+
<div class="method-description">
|
313
|
+
<p>
|
314
|
+
Reads the next value from the string. This can return either a string, a
|
315
|
+
FixNum, a floating point value, a <a href="../JSON.html">JSON</a> array, or
|
316
|
+
a <a href="../JSON.html">JSON</a> object.
|
317
|
+
</p>
|
318
|
+
</div>
|
319
|
+
</div>
|
320
|
+
|
321
|
+
<div id="method-M000035" class="method-detail">
|
322
|
+
<a name="M000035"></a>
|
323
|
+
|
324
|
+
<div class="method-heading">
|
325
|
+
<a href="Lexer.src/M000035.html" target="Code" class="method-signature"
|
326
|
+
onclick="popupCode('Lexer.src/M000035.html');return false;">
|
327
|
+
<span class="method-name">skippast</span><span class="method-args">(to)</span>
|
328
|
+
</a>
|
329
|
+
</div>
|
330
|
+
|
331
|
+
<div class="method-description">
|
332
|
+
<p>
|
333
|
+
Skip past the next instance of the character specified
|
334
|
+
</p>
|
335
|
+
<h5>Parameters</h5>
|
336
|
+
<table>
|
337
|
+
<tr><td valign="top"><tt>to</tt>:</td><td>the character to skip past
|
338
|
+
|
339
|
+
</td></tr>
|
340
|
+
</table>
|
341
|
+
</div>
|
342
|
+
</div>
|
343
|
+
|
344
|
+
<div id="method-M000033" class="method-detail">
|
345
|
+
<a name="M000033"></a>
|
346
|
+
|
347
|
+
<div class="method-heading">
|
348
|
+
<a href="Lexer.src/M000033.html" target="Code" class="method-signature"
|
349
|
+
onclick="popupCode('Lexer.src/M000033.html');return false;">
|
350
|
+
<span class="method-name">skipto</span><span class="method-args">(to)</span>
|
351
|
+
</a>
|
352
|
+
</div>
|
353
|
+
|
354
|
+
<div class="method-description">
|
355
|
+
<p>
|
356
|
+
Skip to the next instance of the character specified
|
357
|
+
</p>
|
358
|
+
<h5>Parameters</h5>
|
359
|
+
<table>
|
360
|
+
<tr><td valign="top"><tt>to</tt>:</td><td>Character to skip to
|
361
|
+
|
362
|
+
</td></tr>
|
363
|
+
</table>
|
364
|
+
</div>
|
365
|
+
</div>
|
366
|
+
|
367
|
+
<div id="method-M000034" class="method-detail">
|
368
|
+
<a name="M000034"></a>
|
369
|
+
|
370
|
+
<div class="method-heading">
|
371
|
+
<a href="Lexer.src/M000034.html" target="Code" class="method-signature"
|
372
|
+
onclick="popupCode('Lexer.src/M000034.html');return false;">
|
373
|
+
<span class="method-name">unescape</span><span class="method-args">()</span>
|
374
|
+
</a>
|
375
|
+
</div>
|
376
|
+
|
377
|
+
<div class="method-description">
|
378
|
+
</div>
|
379
|
+
</div>
|
380
|
+
|
381
|
+
<div id="method-M000029" class="method-detail">
|
382
|
+
<a name="M000029"></a>
|
383
|
+
|
384
|
+
<div class="method-heading">
|
385
|
+
<a href="Lexer.src/M000029.html" target="Code" class="method-signature"
|
386
|
+
onclick="popupCode('Lexer.src/M000029.html');return false;">
|
387
|
+
<span class="method-name">utf8str</span><span class="method-args">(code)</span>
|
388
|
+
</a>
|
389
|
+
</div>
|
390
|
+
|
391
|
+
<div class="method-description">
|
392
|
+
<p>
|
393
|
+
Given a Unicode code point, return a string giving its UTF-8 representation
|
394
|
+
based on RFC 2279.
|
395
|
+
</p>
|
396
|
+
</div>
|
397
|
+
</div>
|
398
|
+
|
399
|
+
|
400
|
+
</div>
|
401
|
+
|
402
|
+
|
403
|
+
</div>
|
404
|
+
|
405
|
+
|
406
|
+
<div id="validator-badges">
|
407
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
408
|
+
</div>
|
409
|
+
|
410
|
+
</body>
|
411
|
+
</html>
|