summaryrefslogtreecommitdiff
path: root/doc/classes/JSON/Pure/Parser.html
diff options
context:
space:
mode:
Diffstat (limited to 'doc/classes/JSON/Pure/Parser.html')
-rw-r--r--doc/classes/JSON/Pure/Parser.html620
1 files changed, 0 insertions, 620 deletions
diff --git a/doc/classes/JSON/Pure/Parser.html b/doc/classes/JSON/Pure/Parser.html
deleted file mode 100644
index 93c5ea4..0000000
--- a/doc/classes/JSON/Pure/Parser.html
+++ /dev/null
@@ -1,620 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <title>JSON::Pure::Parser</title>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <link rel="stylesheet" href="../../../css/reset.css" type="text/css" media="screen" />
-<link rel="stylesheet" href="../../../css/main.css" type="text/css" media="screen" />
-<link rel="stylesheet" href="../../../css/github.css" type="text/css" media="screen" />
-<script src="../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
-<script src="../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
-<script src="../../../js/main.js" type="text/javascript" charset="utf-8"></script>
-<script src="../../../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>
-
-</head>
-
-<body>
- <div class="banner">
-
- <h1>
- <span class="type">Class</span>
- JSON::Pure::Parser
-
- <span class="parent">&lt;
-
- StringScanner
-
- </span>
-
- </h1>
- <ul class="files">
-
- <li><a href="../../../files/lib/json/pure/parser_rb.html">lib/json/pure/parser.rb</a></li>
-
- </ul>
- </div>
- <div id="bodyContent">
- <div id="content">
-
- <div class="description">
-
-<p>This class implements the <a href="../../JSON.html">JSON</a> parser that is
-used to parse a <a href="../../JSON.html">JSON</a> string into a Ruby data
-structure.</p>
-
- </div>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- <!-- Method ref -->
- <div class="sectiontitle">Methods</div>
- <dl class="methods">
-
- <dt>N</dt>
- <dd>
- <ul>
-
-
- <li>
- <a href="#method-c-new">new</a>
- </li>
-
- </ul>
- </dd>
-
- <dt>P</dt>
- <dd>
- <ul>
-
-
- <li>
- <a href="#method-i-parse">parse</a>
- </li>
-
- </ul>
- </dd>
-
- <dt>Q</dt>
- <dd>
- <ul>
-
-
- <li>
- <a href="#method-i-quirks_mode-3F">quirks_mode?</a>
- </li>
-
- </ul>
- </dd>
-
- <dt>R</dt>
- <dd>
- <ul>
-
-
- <li>
- <a href="#method-i-reset">reset</a>
- </li>
-
- </ul>
- </dd>
-
- </dl>
-
-
-
-
-
-
-
-
-
-
-
-
-
- <!-- Section constants -->
- <div class="sectiontitle">Constants</div>
- <table border='0' cellpadding='5'>
-
- <tr valign='top'>
- <td class="attr-name">STRING</td>
- <td>=</td>
- <td class="attr-value">/&quot; ((?:[^\x0-\x1f&quot;\\] |
-# escaped special characters:
-\\[&quot;\\\/bfnrt] |
-\\u[0-9a-fA-F]{4} |
-# match all but escaped special characters:
-\\[\x20-\x21\x23-\x2e\x30-\x5b\x5d-\x61\x63-\x65\x67-\x6d\x6f-\x71\x73\x75-\xff])*)
-&quot;/nx</td>
- </tr>
-
- <tr valign='top'>
- <td>&nbsp;</td>
- <td colspan="2" class="attr-desc"></td>
- </tr>
-
-
- <tr valign='top'>
- <td class="attr-name">INTEGER</td>
- <td>=</td>
- <td class="attr-value">/(-?0|-?[1-9]\d*)/</td>
- </tr>
-
- <tr valign='top'>
- <td>&nbsp;</td>
- <td colspan="2" class="attr-desc"></td>
- </tr>
-
-
- <tr valign='top'>
- <td class="attr-name">FLOAT</td>
- <td>=</td>
- <td class="attr-value">/(-?
-(?:0|[1-9]\d*)
-(?:
-\.\d+(?i:e[+-]?\d+) |
-\.\d+ |
-(?i:e[+-]?\d+)
-)
-)/x</td>
- </tr>
-
- <tr valign='top'>
- <td>&nbsp;</td>
- <td colspan="2" class="attr-desc"></td>
- </tr>
-
-
- <tr valign='top'>
- <td class="attr-name">NAN</td>
- <td>=</td>
- <td class="attr-value">/NaN/</td>
- </tr>
-
- <tr valign='top'>
- <td>&nbsp;</td>
- <td colspan="2" class="attr-desc"></td>
- </tr>
-
-
- <tr valign='top'>
- <td class="attr-name">INFINITY</td>
- <td>=</td>
- <td class="attr-value">/Infinity/</td>
- </tr>
-
- <tr valign='top'>
- <td>&nbsp;</td>
- <td colspan="2" class="attr-desc"></td>
- </tr>
-
-
- <tr valign='top'>
- <td class="attr-name">MINUS_INFINITY</td>
- <td>=</td>
- <td class="attr-value">/-Infinity/</td>
- </tr>
-
- <tr valign='top'>
- <td>&nbsp;</td>
- <td colspan="2" class="attr-desc"></td>
- </tr>
-
-
- <tr valign='top'>
- <td class="attr-name">OBJECT_OPEN</td>
- <td>=</td>
- <td class="attr-value">/\{/</td>
- </tr>
-
- <tr valign='top'>
- <td>&nbsp;</td>
- <td colspan="2" class="attr-desc"></td>
- </tr>
-
-
- <tr valign='top'>
- <td class="attr-name">OBJECT_CLOSE</td>
- <td>=</td>
- <td class="attr-value">/\}/</td>
- </tr>
-
- <tr valign='top'>
- <td>&nbsp;</td>
- <td colspan="2" class="attr-desc"></td>
- </tr>
-
-
- <tr valign='top'>
- <td class="attr-name">ARRAY_OPEN</td>
- <td>=</td>
- <td class="attr-value">/\[/</td>
- </tr>
-
- <tr valign='top'>
- <td>&nbsp;</td>
- <td colspan="2" class="attr-desc"></td>
- </tr>
-
-
- <tr valign='top'>
- <td class="attr-name">ARRAY_CLOSE</td>
- <td>=</td>
- <td class="attr-value">/\]/</td>
- </tr>
-
- <tr valign='top'>
- <td>&nbsp;</td>
- <td colspan="2" class="attr-desc"></td>
- </tr>
-
-
- <tr valign='top'>
- <td class="attr-name">PAIR_DELIMITER</td>
- <td>=</td>
- <td class="attr-value">/:/</td>
- </tr>
-
- <tr valign='top'>
- <td>&nbsp;</td>
- <td colspan="2" class="attr-desc"></td>
- </tr>
-
-
- <tr valign='top'>
- <td class="attr-name">COLLECTION_DELIMITER</td>
- <td>=</td>
- <td class="attr-value">/,/</td>
- </tr>
-
- <tr valign='top'>
- <td>&nbsp;</td>
- <td colspan="2" class="attr-desc"></td>
- </tr>
-
-
- <tr valign='top'>
- <td class="attr-name">TRUE</td>
- <td>=</td>
- <td class="attr-value">/true/</td>
- </tr>
-
- <tr valign='top'>
- <td>&nbsp;</td>
- <td colspan="2" class="attr-desc"></td>
- </tr>
-
-
- <tr valign='top'>
- <td class="attr-name">FALSE</td>
- <td>=</td>
- <td class="attr-value">/false/</td>
- </tr>
-
- <tr valign='top'>
- <td>&nbsp;</td>
- <td colspan="2" class="attr-desc"></td>
- </tr>
-
-
- <tr valign='top'>
- <td class="attr-name">NULL</td>
- <td>=</td>
- <td class="attr-value">/null/</td>
- </tr>
-
- <tr valign='top'>
- <td>&nbsp;</td>
- <td colspan="2" class="attr-desc"></td>
- </tr>
-
-
- <tr valign='top'>
- <td class="attr-name">IGNORE</td>
- <td>=</td>
- <td class="attr-value">%r(
-(?:
-//[^\n\r]*[\n\r]| # line comments
-/\* # c-style comments
-(?:
-[^*/]| # normal chars
-/[^*]| # slashes that do not start a nested comment
-\*[^/]| # asterisks that do not end this comment
-/(?=\*/) # single slash before this comment's end
-)*
-\*/ # the End of this comment
-|[ \t\r\n]+ # whitespaces: space, horicontal tab, lf, cr
-)+
-)mx</td>
- </tr>
-
- <tr valign='top'>
- <td>&nbsp;</td>
- <td colspan="2" class="attr-desc"></td>
- </tr>
-
-
- <tr valign='top'>
- <td class="attr-name">UNPARSED</td>
- <td>=</td>
- <td class="attr-value">Object.new</td>
- </tr>
-
- <tr valign='top'>
- <td>&nbsp;</td>
- <td colspan="2" class="attr-desc"></td>
- </tr>
-
-
- <tr valign='top'>
- <td class="attr-name">UNESCAPE_MAP</td>
- <td>=</td>
- <td class="attr-value">Hash.new { |h, k| h[k] = k.chr }</td>
- </tr>
-
- <tr valign='top'>
- <td>&nbsp;</td>
- <td colspan="2" class="attr-desc"><p>Unescape characters in strings.</p></td>
- </tr>
-
-
- <tr valign='top'>
- <td class="attr-name">EMPTY_8BIT_STRING</td>
- <td>=</td>
- <td class="attr-value">''</td>
- </tr>
-
- <tr valign='top'>
- <td>&nbsp;</td>
- <td colspan="2" class="attr-desc"></td>
- </tr>
-
-
- </table>
-
-
-
-
-
-
- <!-- Methods -->
-
- <div class="sectiontitle">Class Public methods</div>
-
- <div class="method">
- <div class="title method-title" id="method-c-new">
-
- <a name="method-c-new"></a><b>new</b>(source, opts = {})
-
- </div>
-
-
- <div class="description">
- <p>Creates a new <a href="Parser.html">JSON::Pure::Parser</a> instance for the
-string <em>source</em>.</p>
-
-<p>It will be configured by the <em>opts</em> hash. <em>opts</em> can have the
-following keys:</p>
-<ul><li>
-<p><strong>max_nesting</strong>: The maximum depth of nesting allowed in the
-parsed data structures. Disable depth checking with :max_nesting =&gt;
-false|nil|0, it defaults to 19.</p>
-</li><li>
-<p><strong>allow_nan</strong>: If set to true, allow NaN, Infinity and
--Infinity in defiance of RFC 4627 to be parsed by the <a
-href="Parser.html">Parser</a>. This option defaults to false.</p>
-</li><li>
-<p><strong>symbolize_names</strong>: If set to true, returns symbols for the
-names (keys) in a <a href="../../JSON.html">JSON</a> object. Otherwise
-strings are returned, which is also the default.</p>
-</li><li>
-<p><strong>create_additions</strong>: If set to false, the <a
-href="Parser.html">Parser</a> doesn't create additions even if a matchin
-class and create_id was found. This option defaults to true.</p>
-</li><li>
-<p><strong>object_class</strong>: Defaults to Hash</p>
-</li><li>
-<p><strong>array_class</strong>: Defaults to Array</p>
-</li><li>
-<p><strong>quirks_mode</strong>: Enables quirks_mode for parser, that is for
-example parsing single <a href="../../JSON.html">JSON</a> values instead of
-documents is possible.</p>
-</li></ul>
- </div>
-
-
-
-
-
-
- <div class="sourcecode">
-
- <p class="source-link">
- Source:
- <a href="javascript:toggleSource('method-c-new_source')" id="l_method-c-new_source">show</a>
-
- </p>
- <div id="method-c-new_source" class="dyn-source">
- <pre><span class="ruby-comment"># File lib/json/pure/parser.rb, line 73</span>
-<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">initialize</span>(<span class="ruby-identifier">source</span>, <span class="ruby-identifier">opts</span> = {})
- <span class="ruby-identifier">opts</span> <span class="ruby-operator">||=</span> {}
- <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@quirks_mode</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-value">:quirks_mode</span>]
- <span class="ruby-identifier">source</span> = <span class="ruby-identifier">convert_encoding</span> <span class="ruby-identifier">source</span>
- <span class="ruby-keyword">end</span>
- <span class="ruby-keyword">super</span> <span class="ruby-identifier">source</span>
- <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">opts</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-value">:max_nesting</span>) <span class="ruby-comment"># defaults to 19</span>
- <span class="ruby-ivar">@max_nesting</span> = <span class="ruby-number">19</span>
- <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">opts</span>[<span class="ruby-value">:max_nesting</span>]
- <span class="ruby-ivar">@max_nesting</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-value">:max_nesting</span>]
- <span class="ruby-keyword">else</span>
- <span class="ruby-ivar">@max_nesting</span> = <span class="ruby-number">0</span>
- <span class="ruby-keyword">end</span>
- <span class="ruby-ivar">@allow_nan</span> = <span class="ruby-operator">!</span><span class="ruby-operator">!</span><span class="ruby-identifier">opts</span>[<span class="ruby-value">:allow_nan</span>]
- <span class="ruby-ivar">@symbolize_names</span> = <span class="ruby-operator">!</span><span class="ruby-operator">!</span><span class="ruby-identifier">opts</span>[<span class="ruby-value">:symbolize_names</span>]
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">opts</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-value">:create_additions</span>)
- <span class="ruby-ivar">@create_additions</span> = <span class="ruby-operator">!</span><span class="ruby-operator">!</span><span class="ruby-identifier">opts</span>[<span class="ruby-value">:create_additions</span>]
- <span class="ruby-keyword">else</span>
- <span class="ruby-ivar">@create_additions</span> = <span class="ruby-keyword">true</span>
- <span class="ruby-keyword">end</span>
- <span class="ruby-ivar">@create_id</span> = <span class="ruby-ivar">@create_additions</span> <span class="ruby-operator">?</span> <span class="ruby-constant">JSON</span>.<span class="ruby-identifier">create_id</span> <span class="ruby-operator">:</span> <span class="ruby-keyword">nil</span>
- <span class="ruby-ivar">@object_class</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-value">:object_class</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">Hash</span>
- <span class="ruby-ivar">@array_class</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-value">:array_class</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">Array</span>
- <span class="ruby-ivar">@match_string</span> = <span class="ruby-identifier">opts</span>[<span class="ruby-value">:match_string</span>]
-<span class="ruby-keyword">end</span></pre>
- </div>
- </div>
-
- </div>
-
- <div class="sectiontitle">Instance Public methods</div>
-
- <div class="method">
- <div class="title method-title" id="method-i-parse">
-
- <a name="method-i-parse"></a><b>parse</b>()
-
- </div>
-
-
- <div class="description">
- <p>Parses the current <a href="../../JSON.html">JSON</a> string
-<em>source</em> and returns the complete data structure as a result.</p>
- </div>
-
-
-
-
-
-
- <div class="sourcecode">
-
- <p class="source-link">
- Source:
- <a href="javascript:toggleSource('method-i-parse_source')" id="l_method-i-parse_source">show</a>
-
- </p>
- <div id="method-i-parse_source" class="dyn-source">
- <pre><span class="ruby-comment"># File lib/json/pure/parser.rb, line 112</span>
-<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">parse</span>
- <span class="ruby-identifier">reset</span>
- <span class="ruby-identifier">obj</span> = <span class="ruby-keyword">nil</span>
- <span class="ruby-keyword">if</span> <span class="ruby-ivar">@quirks_mode</span>
- <span class="ruby-keyword">while</span> <span class="ruby-operator">!</span><span class="ruby-identifier">eos?</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">skip</span>(<span class="ruby-constant">IGNORE</span>)
- <span class="ruby-keyword">end</span>
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">eos?</span>
- <span class="ruby-identifier">raise</span> <span class="ruby-constant">ParserError</span>, <span class="ruby-string">&quot;source did not contain any JSON!&quot;</span>
- <span class="ruby-keyword">else</span>
- <span class="ruby-identifier">obj</span> = <span class="ruby-identifier">parse_value</span>
- <span class="ruby-identifier">obj</span> <span class="ruby-operator">==</span> <span class="ruby-constant">UNPARSED</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">raise</span> <span class="ruby-constant">ParserError</span>, <span class="ruby-string">&quot;source did not contain any JSON!&quot;</span>
- <span class="ruby-keyword">end</span>
- <span class="ruby-keyword">else</span>
- <span class="ruby-keyword">until</span> <span class="ruby-identifier">eos?</span>
- <span class="ruby-keyword">case</span>
- <span class="ruby-keyword">when</span> <span class="ruby-identifier">scan</span>(<span class="ruby-constant">OBJECT_OPEN</span>)
- <span class="ruby-identifier">obj</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">raise</span> <span class="ruby-constant">ParserError</span>, <span class="ruby-node">&quot;source '#{peek(20)}' not in JSON!&quot;</span>
- <span class="ruby-ivar">@current_nesting</span> = <span class="ruby-number">1</span>
- <span class="ruby-identifier">obj</span> = <span class="ruby-identifier">parse_object</span>
- <span class="ruby-keyword">when</span> <span class="ruby-identifier">scan</span>(<span class="ruby-constant">ARRAY_OPEN</span>)
- <span class="ruby-identifier">obj</span> <span class="ruby-keyword">and</span> <span class="ruby-identifier">raise</span> <span class="ruby-constant">ParserError</span>, <span class="ruby-node">&quot;source '#{peek(20)}' not in JSON!&quot;</span>
- <span class="ruby-ivar">@current_nesting</span> = <span class="ruby-number">1</span>
- <span class="ruby-identifier">obj</span> = <span class="ruby-identifier">parse_array</span>
- <span class="ruby-keyword">when</span> <span class="ruby-identifier">skip</span>(<span class="ruby-constant">IGNORE</span>)
- ;
- <span class="ruby-keyword">else</span>
- <span class="ruby-identifier">raise</span> <span class="ruby-constant">ParserError</span>, <span class="ruby-node">&quot;source '#{peek(20)}' not in JSON!&quot;</span>
- <span class="ruby-keyword">end</span>
- <span class="ruby-keyword">end</span>
- <span class="ruby-identifier">obj</span> <span class="ruby-keyword">or</span> <span class="ruby-identifier">raise</span> <span class="ruby-constant">ParserError</span>, <span class="ruby-string">&quot;source did not contain any JSON!&quot;</span>
- <span class="ruby-keyword">end</span>
- <span class="ruby-identifier">obj</span>
-<span class="ruby-keyword">end</span></pre>
- </div>
- </div>
-
- </div>
-
- <div class="method">
- <div class="title method-title" id="method-i-quirks_mode-3F">
-
- <a name="method-i-quirks_mode-3F"></a><b>quirks_mode?</b>()
-
- </div>
-
-
- <div class="description">
-
- </div>
-
-
-
-
-
-
- <div class="sourcecode">
-
- <p class="source-link">
- Source:
- <a href="javascript:toggleSource('method-i-quirks_mode-3F_source')" id="l_method-i-quirks_mode-3F_source">show</a>
-
- </p>
- <div id="method-i-quirks_mode-3F_source" class="dyn-source">
- <pre><span class="ruby-comment"># File lib/json/pure/parser.rb, line 101</span>
-<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">quirks_mode?</span>
- <span class="ruby-operator">!</span><span class="ruby-operator">!</span><span class="ruby-ivar">@quirks_mode</span>
-<span class="ruby-keyword">end</span></pre>
- </div>
- </div>
-
- </div>
-
- <div class="method">
- <div class="title method-title" id="method-i-reset">
-
- <a name="method-i-reset"></a><b>reset</b>()
-
- </div>
-
-
- <div class="description">
-
- </div>
-
-
-
-
-
-
- <div class="sourcecode">
-
- <p class="source-link">
- Source:
- <a href="javascript:toggleSource('method-i-reset_source')" id="l_method-i-reset_source">show</a>
-
- </p>
- <div id="method-i-reset_source" class="dyn-source">
- <pre><span class="ruby-comment"># File lib/json/pure/parser.rb, line 105</span>
-<span class="ruby-keyword">def</span> <span class="ruby-keyword ruby-title">reset</span>
- <span class="ruby-keyword">super</span>
- <span class="ruby-ivar">@current_nesting</span> = <span class="ruby-number">0</span>
-<span class="ruby-keyword">end</span></pre>
- </div>
- </div>
-
- </div>
- </div>
- </div>
- </body>
-</html> \ No newline at end of file