removed dependencies on global jsonPath and rison. Converted rison into an AMD module.

This commit is contained in:
Spencer Alger 2014-04-25 17:44:43 -07:00
parent 98e0119f10
commit e0c233cfbf
9 changed files with 454 additions and 458 deletions

View file

@ -6,9 +6,7 @@
"globals": { "globals": {
"define": true, "define": true,
"require": true, "require": true,
"console": true, "console": true
"jsonPath": false,
"rison": false
}, },
"camelcase": false, "camelcase": false,

View file

@ -2,6 +2,7 @@ define(function (require) {
var app = require('modules').get('app/discover'); var app = require('modules').get('app/discover');
var html = require('text!../partials/field_chooser.html'); var html = require('text!../partials/field_chooser.html');
var _ = require('lodash'); var _ = require('lodash');
var jsonPath = require('jsonpath');
require('directives/css_truncate'); require('directives/css_truncate');
require('directives/field_name'); require('directives/field_name');

View file

@ -2,6 +2,7 @@ define(function (require) {
var angular = require('angular'); var angular = require('angular');
var _ = require('lodash'); var _ = require('lodash');
var rison = require('utils/rison');
// invokable/private angular dep // invokable/private angular dep
return function ($location) { return function ($location) {

View file

@ -1,8 +1,5 @@
define(function (require) { define(function (require) {
var module = require('modules').get('kibana/factories'); var module = require('modules').get('kibana/factories');
var angular = require('angular');
var _ = require('lodash');
var rison = require('utils/rison');
require('./global_state'); require('./global_state');

View file

@ -2,7 +2,7 @@ define(function (require) {
var _ = require('lodash'); var _ = require('lodash');
var angular = require('angular'); var angular = require('angular');
var qs = require('utils/query_string'); var qs = require('utils/query_string');
var rison = require('utils/rison');
var module = require('modules').get('kibana/global_state'); var module = require('modules').get('kibana/global_state');

View file

@ -4,6 +4,7 @@ define(function (require) {
var moment = require('moment'); var moment = require('moment');
var nextTick = require('utils/next_tick'); var nextTick = require('utils/next_tick');
var qs = require('utils/query_string'); var qs = require('utils/query_string');
var rison = require('utils/rison');
require('config/config'); require('config/config');
require('courier/courier'); require('courier/courier');

View file

@ -3,7 +3,7 @@ define(function (require) {
var _ = require('lodash'); var _ = require('lodash');
var nextTick = require('utils/next_tick'); var nextTick = require('utils/next_tick');
var $ = require('jquery'); var $ = require('jquery');
var jsonpath = require('jsonpath'); var jsonPath = require('jsonpath');
require('directives/truncated'); require('directives/truncated');
require('directives/infinite_scroll'); require('directives/infinite_scroll');

View file

@ -8,7 +8,6 @@ define(function (require) {
var modules = require('modules'); var modules = require('modules');
var routes = require('routes'); var routes = require('routes');
require('utils/rison');
require('elasticsearch'); require('elasticsearch');
require('angular-route'); require('angular-route');
require('angular-bindonce'); require('angular-bindonce');

View file

@ -1,499 +1,498 @@
/* jshint ignore:start */ define(function () {
var rison = {};
/* jshint ignore:start */
//////////////////////////////////////////////////
//
// the stringifier is based on
// http://json.org/json.js as of 2006-04-28 from json.org
// the parser is based on
// http://osteele.com/sources/openlaszlo/json
//
////////////////////////////////////////////////// /**
// * rules for an uri encoder that is more tolerant than encodeURIComponent
// the stringifier is based on *
// http://json.org/json.js as of 2006-04-28 from json.org * encodeURIComponent passes ~!*()-_.'
// the parser is based on *
// http://osteele.com/sources/openlaszlo/json * we also allow ,:@$/
// *
*/
rison.uri_ok = { // ok in url paths and in form query args
'~': true, '!': true, '*': true, '(': true, ')': true,
'-': true, '_': true, '.': true, ',': true,
':': true, '@': true, '$': true,
"'": true, '/': true
};
if (typeof rison == 'undefined') /*
window.rison = {}; * we divide the uri-safe glyphs into three sets
* <rison> - used by rison ' ! : ( ) ,
* <reserved> - not common in strings, reserved * @ $ & ; =
*
* we define <identifier> as anything that's not forbidden
*/
/** /**
* rules for an uri encoder that is more tolerant than encodeURIComponent * punctuation characters that are legal inside ids.
* */
* encodeURIComponent passes ~!*()-_.' // this var isn't actually used
* //rison.idchar_punctuation = "_-./~";
* we also allow ,:@$/
*
*/
rison.uri_ok = { // ok in url paths and in form query args
'~': true, '!': true, '*': true, '(': true, ')': true,
'-': true, '_': true, '.': true, ',': true,
':': true, '@': true, '$': true,
"'": true, '/': true
};
/* (function () {
* we divide the uri-safe glyphs into three sets var l = [];
* <rison> - used by rison ' ! : ( ) , for (var hi = 0; hi < 16; hi++) {
* <reserved> - not common in strings, reserved * @ $ & ; = for (var lo = 0; lo < 16; lo++) {
* if (hi+lo == 0) continue;
* we define <identifier> as anything that's not forbidden var c = String.fromCharCode(hi*16 + lo);
*/ if (! /\w|[-_.\/~]/.test(c))
l.push('\\u00' + hi.toString(16) + lo.toString(16));
/** }
* punctuation characters that are legal inside ids. }
*/ /**
// this var isn't actually used * characters that are illegal inside ids.
//rison.idchar_punctuation = "_-./~"; * <rison> and <reserved> classes are illegal in ids.
*
(function () { */
var l = []; rison.not_idchar = l.join('')
for (var hi = 0; hi < 16; hi++) { //idcrx = new RegExp('[' + rison.not_idchar + ']');
for (var lo = 0; lo < 16; lo++) { //console.log('NOT', (idcrx.test(' ')) );
if (hi+lo == 0) continue; })();
var c = String.fromCharCode(hi*16 + lo); //rison.not_idchar = " \t\r\n\"<>[]{}'!=:(),*@$;&";
if (! /\w|[-_.\/~]/.test(c)) rison.not_idchar = " '!:(),*@$";
l.push('\\u00' + hi.toString(16) + lo.toString(16));
}
}
/**
* characters that are illegal inside ids.
* <rison> and <reserved> classes are illegal in ids.
*
*/
rison.not_idchar = l.join('')
//idcrx = new RegExp('[' + rison.not_idchar + ']');
//console.log('NOT', (idcrx.test(' ')) );
})();
//rison.not_idchar = " \t\r\n\"<>[]{}'!=:(),*@$;&";
rison.not_idchar = " '!:(),*@$";
/** /**
* characters that are illegal as the start of an id * characters that are illegal as the start of an id
* this is so ids can't look like numbers. * this is so ids can't look like numbers.
*/ */
rison.not_idstart = "-0123456789"; rison.not_idstart = "-0123456789";
(function () { (function () {
var idrx = '[^' + rison.not_idstart + rison.not_idchar + var idrx = '[^' + rison.not_idstart + rison.not_idchar +
'][^' + rison.not_idchar + ']*'; '][^' + rison.not_idchar + ']*';
rison.id_ok = new RegExp('^' + idrx + '$'); rison.id_ok = new RegExp('^' + idrx + '$');
// regexp to find the end of an id when parsing // regexp to find the end of an id when parsing
// g flag on the regexp is necessary for iterative regexp.exec() // g flag on the regexp is necessary for iterative regexp.exec()
rison.next_id = new RegExp(idrx, 'g'); rison.next_id = new RegExp(idrx, 'g');
})(); })();
/** /**
* this is like encodeURIComponent() but quotes fewer characters. * this is like encodeURIComponent() but quotes fewer characters.
* *
* @see rison.uri_ok * @see rison.uri_ok
* *
* encodeURIComponent passes ~!*()-_.' * encodeURIComponent passes ~!*()-_.'
* rison.quote also passes ,:@$/ * rison.quote also passes ,:@$/
* and quotes " " as "+" instead of "%20" * and quotes " " as "+" instead of "%20"
*/ */
rison.quote = function(x) { rison.quote = function(x) {
if (/^[-A-Za-z0-9~!*()_.',:@$\/]*$/.test(x)) if (/^[-A-Za-z0-9~!*()_.',:@$\/]*$/.test(x))
return x; return x;
return encodeURIComponent(x) return encodeURIComponent(x)
.replace('%2C', ',', 'g') .replace('%2C', ',', 'g')
.replace('%3A', ':', 'g') .replace('%3A', ':', 'g')
.replace('%40', '@', 'g') .replace('%40', '@', 'g')
.replace('%24', '$', 'g') .replace('%24', '$', 'g')
.replace('%2F', '/', 'g') .replace('%2F', '/', 'g')
.replace('%20', '+', 'g'); .replace('%20', '+', 'g');
}; };
// //
// based on json.js 2006-04-28 from json.org // based on json.js 2006-04-28 from json.org
// license: http://www.json.org/license.html // license: http://www.json.org/license.html
// //
// hacked by nix for use in uris. // hacked by nix for use in uris.
// //
(function () { (function () {
var sq = { // url-ok but quoted in strings var sq = { // url-ok but quoted in strings
"'": true, '!': true "'": true, '!': true
}, },
enc = function (v) { enc = function (v) {
if (v && typeof v.toJSON === 'function') v = v.toJSON(); if (v && typeof v.toJSON === 'function') v = v.toJSON();
var fn = s[typeof v]; var fn = s[typeof v];
if (fn) return fn(v); if (fn) return fn(v);
}, },
s = { s = {
array: function (x) { array: function (x) {
var a = ['!('], b, f, i, l = x.length, v; var a = ['!('], b, f, i, l = x.length, v;
for (i = 0; i < l; i += 1) { for (i = 0; i < l; i += 1) {
v = enc(x[i]); v = enc(x[i]);
if (typeof v == 'string') { if (typeof v == 'string') {
if (b) { if (b) {
a[a.length] = ','; a[a.length] = ',';
} }
a[a.length] = v; a[a.length] = v;
b = true; b = true;
} }
} }
a[a.length] = ')'; a[a.length] = ')';
return a.join(''); return a.join('');
}, },
'boolean': function (x) { 'boolean': function (x) {
if (x) if (x)
return '!t'; return '!t';
return '!f' return '!f'
}, },
'null': function (x) { 'null': function (x) {
return "!n"; return "!n";
}, },
number: function (x) { number: function (x) {
if (!isFinite(x)) if (!isFinite(x))
return '!n'; return '!n';
// strip '+' out of exponent, '-' is ok though // strip '+' out of exponent, '-' is ok though
return String(x).replace(/\+/,''); return String(x).replace(/\+/,'');
}, },
object: function (x) { object: function (x) {
if (x) { if (x) {
if (x instanceof Array) { if (x instanceof Array) {
return s.array(x); return s.array(x);
} }
var a = ['('], b, f, i, v, ki, ks=[]; var a = ['('], b, f, i, v, ki, ks=[];
for (i in x) for (i in x)
ks[ks.length] = i; ks[ks.length] = i;
ks.sort(); ks.sort();
for (ki = 0; ki < ks.length; ki++) { for (ki = 0; ki < ks.length; ki++) {
i = ks[ki]; i = ks[ki];
v = enc(x[i]); v = enc(x[i]);
if (typeof v == 'string') { if (typeof v == 'string') {
if (b) { if (b) {
a[a.length] = ','; a[a.length] = ',';
} }
a.push(s.string(i), ':', v); a.push(s.string(i), ':', v);
b = true; b = true;
} }
} }
a[a.length] = ')'; a[a.length] = ')';
return a.join(''); return a.join('');
} }
return '!n'; return '!n';
}, },
string: function (x) { string: function (x) {
if (x == '') if (x == '')
return "''"; return "''";
if (rison.id_ok.test(x)) if (rison.id_ok.test(x))
return x; return x;
x = x.replace(/(['!])/g, function(a, b) { x = x.replace(/(['!])/g, function(a, b) {
if (sq[b]) return '!'+b; if (sq[b]) return '!'+b;
return b; return b;
}); });
return "'" + x + "'"; return "'" + x + "'";
}, },
undefined: function (x) { undefined: function (x) {
// ignore undefined just like JSON // ignore undefined just like JSON
// throw new Error("rison can't encode the undefined value"); // throw new Error("rison can't encode the undefined value");
} }
}; };
/** /**
* rison-encode a javascript structure * rison-encode a javascript structure
* *
* implemementation based on Douglas Crockford's json.js: * implemementation based on Douglas Crockford's json.js:
* http://json.org/json.js as of 2006-04-28 from json.org * http://json.org/json.js as of 2006-04-28 from json.org
* *
*/ */
rison.encode = function (v) { rison.encode = function (v) {
return enc(v); return enc(v);
}; };
/** /**
* rison-encode a javascript object without surrounding parens * rison-encode a javascript object without surrounding parens
* *
*/ */
rison.encode_object = function (v) { rison.encode_object = function (v) {
if (typeof v != 'object' || v === null || v instanceof Array) if (typeof v != 'object' || v === null || v instanceof Array)
throw new Error("rison.encode_object expects an object argument"); throw new Error("rison.encode_object expects an object argument");
var r = s[typeof v](v); var r = s[typeof v](v);
return r.substring(1, r.length-1); return r.substring(1, r.length-1);
}; };
/** /**
* rison-encode a javascript array without surrounding parens * rison-encode a javascript array without surrounding parens
* *
*/ */
rison.encode_array = function (v) { rison.encode_array = function (v) {
if (!(v instanceof Array)) if (!(v instanceof Array))
throw new Error("rison.encode_array expects an array argument"); throw new Error("rison.encode_array expects an array argument");
var r = s[typeof v](v); var r = s[typeof v](v);
return r.substring(2, r.length-1); return r.substring(2, r.length-1);
}; };
/** /**
* rison-encode and uri-encode a javascript structure * rison-encode and uri-encode a javascript structure
* *
*/ */
rison.encode_uri = function (v) { rison.encode_uri = function (v) {
return rison.quote(s[typeof v](v)); return rison.quote(s[typeof v](v));
}; };
})(); })();
// //
// based on openlaszlo-json and hacked by nix for use in uris. // based on openlaszlo-json and hacked by nix for use in uris.
// //
// Author: Oliver Steele // Author: Oliver Steele
// Copyright: Copyright 2006 Oliver Steele. All rights reserved. // Copyright: Copyright 2006 Oliver Steele. All rights reserved.
// Homepage: http://osteele.com/sources/openlaszlo/json // Homepage: http://osteele.com/sources/openlaszlo/json
// License: MIT License. // License: MIT License.
// Version: 1.0 // Version: 1.0
/** /**
* parse a rison string into a javascript structure. * parse a rison string into a javascript structure.
* *
* this is the simplest decoder entry point. * this is the simplest decoder entry point.
* *
* based on Oliver Steele's OpenLaszlo-JSON * based on Oliver Steele's OpenLaszlo-JSON
* http://osteele.com/sources/openlaszlo/json * http://osteele.com/sources/openlaszlo/json
*/ */
rison.decode = function(r) { rison.decode = function(r) {
var errcb = function(e) { throw Error('rison decoder error: ' + e); }; var errcb = function(e) { throw Error('rison decoder error: ' + e); };
var p = new rison.parser(errcb); var p = new rison.parser(errcb);
return p.parse(r); return p.parse(r);
}; };
/** /**
* parse an o-rison string into a javascript structure. * parse an o-rison string into a javascript structure.
* *
* this simply adds parentheses around the string before parsing. * this simply adds parentheses around the string before parsing.
*/ */
rison.decode_object = function(r) { rison.decode_object = function(r) {
return rison.decode('('+r+')'); return rison.decode('('+r+')');
}; };
/** /**
* parse an a-rison string into a javascript structure. * parse an a-rison string into a javascript structure.
* *
* this simply adds array markup around the string before parsing. * this simply adds array markup around the string before parsing.
*/ */
rison.decode_array = function(r) { rison.decode_array = function(r) {
return rison.decode('!('+r+')'); return rison.decode('!('+r+')');
}; };
/** /**
* construct a new parser object for reuse. * construct a new parser object for reuse.
* *
* @constructor * @constructor
* @class A Rison parser class. You should probably * @class A Rison parser class. You should probably
* use rison.decode instead. * use rison.decode instead.
* @see rison.decode * @see rison.decode
*/ */
rison.parser = function (errcb) { rison.parser = function (errcb) {
this.errorHandler = errcb; this.errorHandler = errcb;
}; };
/** /**
* a string containing acceptable whitespace characters. * a string containing acceptable whitespace characters.
* by default the rison decoder tolerates no whitespace. * by default the rison decoder tolerates no whitespace.
* to accept whitespace set rison.parser.WHITESPACE = " \t\n\r\f"; * to accept whitespace set rison.parser.WHITESPACE = " \t\n\r\f";
*/ */
rison.parser.WHITESPACE = ""; rison.parser.WHITESPACE = "";
// expose this as-is? // expose this as-is?
rison.parser.prototype.setOptions = function (options) { rison.parser.prototype.setOptions = function (options) {
if (options['errorHandler']) if (options['errorHandler'])
this.errorHandler = options.errorHandler; this.errorHandler = options.errorHandler;
}; };
/** /**
* parse a rison string into a javascript structure. * parse a rison string into a javascript structure.
*/ */
rison.parser.prototype.parse = function (str) { rison.parser.prototype.parse = function (str) {
this.string = str; this.string = str;
this.index = 0; this.index = 0;
this.message = null; this.message = null;
var value = this.readValue(); var value = this.readValue();
if (!this.message && this.next()) if (!this.message && this.next())
value = this.error("unable to parse string as rison: '" + rison.encode(str) + "'"); value = this.error("unable to parse string as rison: '" + rison.encode(str) + "'");
if (this.message && this.errorHandler) if (this.message && this.errorHandler)
this.errorHandler(this.message, this.index); this.errorHandler(this.message, this.index);
return value; return value;
}; };
rison.parser.prototype.error = function (message) { rison.parser.prototype.error = function (message) {
if (typeof(console) != 'undefined') if (typeof(console) != 'undefined')
console.log('rison parser error: ', message); console.log('rison parser error: ', message);
this.message = message; this.message = message;
return undefined; return undefined;
} }
rison.parser.prototype.readValue = function () { rison.parser.prototype.readValue = function () {
var c = this.next(); var c = this.next();
var fn = c && this.table[c]; var fn = c && this.table[c];
if (fn) if (fn)
return fn.apply(this); return fn.apply(this);
// fell through table, parse as an id // fell through table, parse as an id
var s = this.string; var s = this.string;
var i = this.index-1; var i = this.index-1;
// Regexp.lastIndex may not work right in IE before 5.5? // Regexp.lastIndex may not work right in IE before 5.5?
// g flag on the regexp is also necessary // g flag on the regexp is also necessary
rison.next_id.lastIndex = i; rison.next_id.lastIndex = i;
var m = rison.next_id.exec(s); var m = rison.next_id.exec(s);
// console.log('matched id', i, r.lastIndex); // console.log('matched id', i, r.lastIndex);
if (m.length > 0) { if (m.length > 0) {
var id = m[0]; var id = m[0];
this.index = i+id.length; this.index = i+id.length;
return id; // a string return id; // a string
} }
if (c) return this.error("invalid character: '" + c + "'"); if (c) return this.error("invalid character: '" + c + "'");
return this.error("empty expression"); return this.error("empty expression");
} }
rison.parser.parse_array = function (parser) { rison.parser.parse_array = function (parser) {
var ar = []; var ar = [];
var c; var c;
while ((c = parser.next()) != ')') { while ((c = parser.next()) != ')') {
if (!c) return parser.error("unmatched '!('"); if (!c) return parser.error("unmatched '!('");
if (ar.length) { if (ar.length) {
if (c != ',') if (c != ',')
parser.error("missing ','"); parser.error("missing ','");
} else if (c == ',') { } else if (c == ',') {
return parser.error("extra ','"); return parser.error("extra ','");
} else } else
--parser.index; --parser.index;
var n = parser.readValue(); var n = parser.readValue();
if (typeof n == "undefined") return undefined; if (typeof n == "undefined") return undefined;
ar.push(n); ar.push(n);
} }
return ar; return ar;
}; };
rison.parser.bangs = { rison.parser.bangs = {
t: true, t: true,
f: false, f: false,
n: null, n: null,
'(': rison.parser.parse_array '(': rison.parser.parse_array
} }
rison.parser.prototype.table = { rison.parser.prototype.table = {
'!': function () { '!': function () {
var s = this.string; var s = this.string;
var c = s.charAt(this.index++); var c = s.charAt(this.index++);
if (!c) return this.error('"!" at end of input'); if (!c) return this.error('"!" at end of input');
var x = rison.parser.bangs[c]; var x = rison.parser.bangs[c];
if (typeof(x) == 'function') { if (typeof(x) == 'function') {
return x.call(null, this); return x.call(null, this);
} else if (typeof(x) == 'undefined') { } else if (typeof(x) == 'undefined') {
return this.error('unknown literal: "!' + c + '"'); return this.error('unknown literal: "!' + c + '"');
} }
return x; return x;
}, },
'(': function () { '(': function () {
var o = {}; var o = {};
var c; var c;
var count = 0; var count = 0;
while ((c = this.next()) != ')') { while ((c = this.next()) != ')') {
if (count) { if (count) {
if (c != ',') if (c != ',')
this.error("missing ','"); this.error("missing ','");
} else if (c == ',') { } else if (c == ',') {
return this.error("extra ','"); return this.error("extra ','");
} else } else
--this.index; --this.index;
var k = this.readValue(); var k = this.readValue();
if (typeof k == "undefined") return undefined; if (typeof k == "undefined") return undefined;
if (this.next() != ':') return this.error("missing ':'"); if (this.next() != ':') return this.error("missing ':'");
var v = this.readValue(); var v = this.readValue();
if (typeof v == "undefined") return undefined; if (typeof v == "undefined") return undefined;
o[k] = v; o[k] = v;
count++; count++;
} }
return o; return o;
}, },
"'": function () { "'": function () {
var s = this.string; var s = this.string;
var i = this.index; var i = this.index;
var start = i; var start = i;
var segments = []; var segments = [];
var c; var c;
while ((c = s.charAt(i++)) != "'") { while ((c = s.charAt(i++)) != "'") {
//if (i == s.length) return this.error('unmatched "\'"'); //if (i == s.length) return this.error('unmatched "\'"');
if (!c) return this.error('unmatched "\'"'); if (!c) return this.error('unmatched "\'"');
if (c == '!') { if (c == '!') {
if (start < i-1) if (start < i-1)
segments.push(s.slice(start, i-1)); segments.push(s.slice(start, i-1));
c = s.charAt(i++); c = s.charAt(i++);
if ("!'".indexOf(c) >= 0) { if ("!'".indexOf(c) >= 0) {
segments.push(c); segments.push(c);
} else { } else {
return this.error('invalid string escape: "!'+c+'"'); return this.error('invalid string escape: "!'+c+'"');
} }
start = i; start = i;
} }
} }
if (start < i-1) if (start < i-1)
segments.push(s.slice(start, i-1)); segments.push(s.slice(start, i-1));
this.index = i; this.index = i;
return segments.length == 1 ? segments[0] : segments.join(''); return segments.length == 1 ? segments[0] : segments.join('');
}, },
// Also any digit. The statement that follows this table // Also any digit. The statement that follows this table
// definition fills in the digits. // definition fills in the digits.
'-': function () { '-': function () {
var s = this.string; var s = this.string;
var i = this.index; var i = this.index;
var start = i-1; var start = i-1;
var state = 'int'; var state = 'int';
var permittedSigns = '-'; var permittedSigns = '-';
var transitions = { var transitions = {
'int+.': 'frac', 'int+.': 'frac',
'int+e': 'exp', 'int+e': 'exp',
'frac+e': 'exp' 'frac+e': 'exp'
}; };
do { do {
var c = s.charAt(i++); var c = s.charAt(i++);
if (!c) break; if (!c) break;
if ('0' <= c && c <= '9') continue; if ('0' <= c && c <= '9') continue;
if (permittedSigns.indexOf(c) >= 0) { if (permittedSigns.indexOf(c) >= 0) {
permittedSigns = ''; permittedSigns = '';
continue; continue;
} }
state = transitions[state+'+'+c.toLowerCase()]; state = transitions[state+'+'+c.toLowerCase()];
if (state == 'exp') permittedSigns = '-'; if (state == 'exp') permittedSigns = '-';
} while (state); } while (state);
this.index = --i; this.index = --i;
s = s.slice(start, i) s = s.slice(start, i)
if (s == '-') return this.error("invalid number"); if (s == '-') return this.error("invalid number");
return Number(s); return Number(s);
} }
}; };
// copy table['-'] to each of table[i] | i <- '0'..'9': // copy table['-'] to each of table[i] | i <- '0'..'9':
(function (table) { (function (table) {
for (var i = 0; i <= 9; i++) for (var i = 0; i <= 9; i++)
table[String(i)] = table['-']; table[String(i)] = table['-'];
})(rison.parser.prototype.table); })(rison.parser.prototype.table);
// return the next non-whitespace character, or undefined // return the next non-whitespace character, or undefined
rison.parser.prototype.next = function () { rison.parser.prototype.next = function () {
var s = this.string; var s = this.string;
var i = this.index; var i = this.index;
do { do {
if (i == s.length) return undefined; if (i == s.length) return undefined;
var c = s.charAt(i++); var c = s.charAt(i++);
} while (rison.parser.WHITESPACE.indexOf(c) >= 0); } while (rison.parser.WHITESPACE.indexOf(c) >= 0);
this.index = i; this.index = i;
return c; return c;
}; };
/* jshint ignore:end */
/* jshint ignore:end */ return rison;
});