+
+// <script type="text/javascript">
+
+
+toPretty = function toPretty(str)
+{
+ var tr = new JSDOC.TokenReader();
+ var toks = tr.tokenize(str,false); // dont merge xxx + . + yyyy etc.
+ var sp = new JSDOC.ScopeParser(new JSDOC.TokenStream(toks));
+ sp.buildSymbolTree();
+ // sp.mungeSymboltree();
+ var r = '';
+ r += sp.warnings.join("<BR>");
+ r == "<BR>";
+
+
+
+
+ var cs = ''; // current style..
+
+ function toStyle(tok)
+ {
+ if (tok.isType("whitespace")) {
+ if (tok.data.indexOf("/") > -1) {
+ return 'comment';
+ }
+ return cs; // keep the same..
+ }
+ if (tok.isType('string')) {
+ return 'string';
+ }
+ // other 'vary things??
+ if (tok.isType('identifier') || tok.isType('dot') || tok.isType('this')) {
+ return 'var';
+ }
+ if (/^[a-z]+/i.test(tok.data)) {
+ return 'keyword';
+ }
+ return 'syntax'
+
+ }
+ // loop through and print it...?
+
+
+ for (var i = 0;i < toks.length; i++) {
+ var ns = toStyle(toks[i]);
+ if (ns != cs) {
+ // change of style
+ if (cs.length) r +='</span>';
+ r +='<span class="jsdoc-'+ns+'">';
+ cs = ns;
+ }
+ if (toks[i].identifier) {
+
+ r += '<span class="with-ident2">' +
+ htmlescape(toks[i].data) + '</span>';
+ continue;
+
+ }
+ r += htmlescape(toks[i].data).replace(/\n/g, '<BR>');
+ }
+ if (cs.length) r +='</span>';
+ return '<code class="jsdoc-pretty">'+r+'</code>';
+
+
+}