mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-17 21:43:11 +01:00
99 lines
5.3 KiB
HTML
99 lines
5.3 KiB
HTML
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||
|
<title>.: jsolait :. | documentation | lang</title>
|
||
|
<link rel="stylesheet" type="text/css" href="./html.css" />
|
||
|
<meta name="author" content="Jan-Klaas Kollhof" />
|
||
|
<meta name="keywords" content="jsolait.lang" />
|
||
|
</head>
|
||
|
<body>
|
||
|
<a name="top" id="top"></a>
|
||
|
<div class="navigationBar"><a href="./index.xhtml">documentation</a> |
|
||
|
lang</div>
|
||
|
<div class="menu">
|
||
|
<ul></ul>
|
||
|
<div class="copyright">copyright © 2004, Jan-Klaas Kollhof</div>
|
||
|
</div>
|
||
|
<div class="content">
|
||
|
<h1>Module lang</h1>
|
||
|
|
||
|
This module provides language services like tokenizing JavaScript code
|
||
|
or converting JavaScript objects to and from <a href="http://json.org" target="_blank">JSON</a>.<br />
|
||
|
To customize JSON serialization of Objects just overwrite the toJSON method in your class.
|
||
|
<div class="contentItem"><h2>public members:<a class="bttop" href="#top">▲</a></h2><div>
|
||
|
|
||
|
<h3>JSONParser()</h3><div class="indent">
|
||
|
A class for parsing JSON.<br />
|
||
|
<ul>
|
||
|
<li><b>JSONParser::addLib(obj,name,exports)</b><br />
|
||
|
Adds a lib object for converting application specific JSON-Objects.<br />
|
||
|
This is an extension to the default JSON behavior to allow class hinitng.
|
||
|
</li>
|
||
|
<li><b>JSONParser::jsonToObj(data)</b><br />
|
||
|
Turns JSON code into JavaScript objects.<br />
|
||
|
<code>data</code> is a String containing the JSON code.
|
||
|
</li>
|
||
|
<li><b>JSONParser::objToJson(obj)</b><br />
|
||
|
Turns an object into JSON.<br />
|
||
|
This is the same as calling obj.toJSON();<br />
|
||
|
</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
<h3>parser</h3><div class="indent">
|
||
|
A JSONParser object used for jsonToObj and objToJson.
|
||
|
</div>
|
||
|
<h3>jsonToObj(src)</h3><div class="indent">
|
||
|
Turns JSON code into JavaScript objects.<br />
|
||
|
<code>src</code> is a String containing the JSON code.
|
||
|
</div>
|
||
|
<h3>objToJson(obj)</h3><div class="indent">
|
||
|
Turns an object into JSON.<br />
|
||
|
This is the same as calling obj.toJSON();<br />
|
||
|
</div>
|
||
|
<h3>tokens</h3><div class="indent">
|
||
|
Token type constants for the tokenizer.<br />
|
||
|
<ul>
|
||
|
<li><b>tokens.WSP</b> WhiteSpace </li>
|
||
|
<li><b>tokens.OP</b> Operator </li>
|
||
|
<li><b>tokens.STR</b> String</li>
|
||
|
<li><b>tokens.NAME</b> Name</li>
|
||
|
<li><b>tokens.NUM</b> Number</li>
|
||
|
<li><b>tokens.ERR</b> Error</li>
|
||
|
<li><b>tokens.NL</b> NewLine </li>
|
||
|
<li><b>tokens.COMMENT</b> Comment </li>
|
||
|
<li><b>tokens.DOCCOMMENT</b> Documentation comment </li>
|
||
|
<li><b>tokens.REGEXP</b> Regular Expression</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
|
||
|
<h3>Tokenizer(source)</h3><div class="indent">
|
||
|
Tokenizer Class which incrementally parses JavaScript code(<code>source</code>) and returns the language tokens.<br />
|
||
|
<ul>
|
||
|
<li><b>Tokenizer::next()</b><br />
|
||
|
Returns the next Token object.
|
||
|
</li>
|
||
|
<li><b>Tokenizer::nextNonWS(nlIsWS)</b><br />
|
||
|
Returns the next non whitespace token.<br />
|
||
|
If <code>nlIsWS</code> is <code>true</code> then a NewLine token is interpreted as whitespace.
|
||
|
</li>
|
||
|
<li><b>Tokenizer::finished()</b><br />
|
||
|
Returns <code>true</code> if the Tokenizer has finished the parsing.
|
||
|
</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
|
||
|
<h3>Token(type, value, pos, err)</h3><div class="indent">
|
||
|
Token class for token objects returned by the Tokenizer.<br />
|
||
|
<ul>
|
||
|
<li><b>Token::type</b>The type of the token(see the tokens constants).</li>
|
||
|
<li><b>Token::value</b>A String containing the token value.</li>
|
||
|
<li><b>Token::pos</b>The starting position of the token in the source .</li>
|
||
|
<li><b>Token::err</b>The error object for Error tokens.</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
</div></div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|