|
233 | 233 | while (this.current < stream.length) {
|
234 | 234 | if (isAlpha(stream[this.current])) {
|
235 | 235 | start = this.current;
|
236 |
| - identifier = this.consumeUnquotedIdentifier(stream); |
| 236 | + identifier = this.__consumeUnquotedIdentifier(stream); |
237 | 237 | tokens.push({type: TOK_UNQUOTEDIDENTIFIER,
|
238 | 238 | value: identifier,
|
239 | 239 | start: start});
|
|
243 | 243 | start: this.current});
|
244 | 244 | this.current++;
|
245 | 245 | } else if (isNum(stream[this.current])) {
|
246 |
| - token = this.consumeNumber(stream); |
| 246 | + token = this.__consumeNumber(stream); |
247 | 247 | tokens.push(token);
|
248 | 248 | } else if (stream[this.current] === "[") {
|
249 | 249 | // No need to increment this.current. This happens
|
250 |
| - // in consumeLBracket |
251 |
| - token = this.consumeLBracket(stream); |
| 250 | + // in __consumeLBracket |
| 251 | + token = this.__consumeLBracket(stream); |
252 | 252 | tokens.push(token);
|
253 | 253 | } else if (stream[this.current] === "\"") {
|
254 | 254 | start = this.current;
|
255 |
| - identifier = this.consumeQuotedIdentifier(stream); |
| 255 | + identifier = this.__consumeQuotedIdentifier(stream); |
256 | 256 | tokens.push({type: TOK_QUOTEDIDENTIFIER,
|
257 | 257 | value: identifier,
|
258 | 258 | start: start});
|
259 | 259 | } else if (stream[this.current] === "'") {
|
260 | 260 | start = this.current;
|
261 |
| - identifier = this.consumeRawStringLiteral(stream); |
| 261 | + identifier = this.__consumeRawStringLiteral(stream); |
262 | 262 | tokens.push({type: TOK_LITERAL,
|
263 | 263 | value: identifier,
|
264 | 264 | start: start});
|
265 | 265 | } else if (stream[this.current] === "`") {
|
266 | 266 | start = this.current;
|
267 |
| - var literal = this.consumeLiteral(stream); |
| 267 | + var literal = this.__consumeLiteral(stream); |
268 | 268 | tokens.push({type: TOK_LITERAL,
|
269 | 269 | value: literal,
|
270 | 270 | start: start});
|
271 | 271 | } else if (operatorStartToken[stream[this.current]] !== undefined) {
|
272 |
| - tokens.push(this.consumeOperator(stream)); |
| 272 | + tokens.push(this.__consumeOperator(stream)); |
273 | 273 | } else if (skipChars[stream[this.current]] !== undefined) {
|
274 | 274 | // Ignore whitespace.
|
275 | 275 | this.current++;
|
|
300 | 300 | return tokens;
|
301 | 301 | },
|
302 | 302 |
|
303 |
| - consumeUnquotedIdentifier: function(stream) { |
| 303 | + __consumeUnquotedIdentifier: function(stream) { |
304 | 304 | var start = this.current;
|
305 | 305 | this.current++;
|
306 | 306 | while (this.current < stream.length && isAlphaNum(stream[this.current])) {
|
|
309 | 309 | return stream.slice(start, this.current);
|
310 | 310 | },
|
311 | 311 |
|
312 |
| - consumeQuotedIdentifier: function(stream) { |
| 312 | + __consumeQuotedIdentifier: function(stream) { |
313 | 313 | var start = this.current;
|
314 | 314 | this.current++;
|
315 | 315 | var maxLength = stream.length;
|
|
328 | 328 | return JSON.parse(stream.slice(start, this.current));
|
329 | 329 | },
|
330 | 330 |
|
331 |
| - consumeRawStringLiteral: function(stream) { |
| 331 | + __consumeRawStringLiteral: function(stream) { |
332 | 332 | var start = this.current;
|
333 | 333 | this.current++;
|
334 | 334 | var maxLength = stream.length;
|
|
348 | 348 | return literal.replace("\\'", "'");
|
349 | 349 | },
|
350 | 350 |
|
351 |
| - consumeNumber: function(stream) { |
| 351 | + __consumeNumber: function(stream) { |
352 | 352 | var start = this.current;
|
353 | 353 | this.current++;
|
354 | 354 | var maxLength = stream.length;
|
|
359 | 359 | return {type: TOK_NUMBER, value: value, start: start};
|
360 | 360 | },
|
361 | 361 |
|
362 |
| - consumeLBracket: function(stream) { |
| 362 | + __consumeLBracket: function(stream) { |
363 | 363 | var start = this.current;
|
364 | 364 | this.current++;
|
365 | 365 | if (stream[this.current] === "?") {
|
|
373 | 373 | }
|
374 | 374 | },
|
375 | 375 |
|
376 |
| - consumeOperator: function(stream) { |
| 376 | + __consumeOperator: function(stream) { |
377 | 377 | var start = this.current;
|
378 | 378 | var startingChar = stream[start];
|
379 | 379 | this.current++;
|
|
406 | 406 | }
|
407 | 407 | },
|
408 | 408 |
|
409 |
| - consumeLiteral: function(stream) { |
| 409 | + __consumeLiteral: function(stream) { |
410 | 410 | this.current++;
|
411 | 411 | var start = this.current;
|
412 | 412 | var maxLength = stream.length;
|
|
424 | 424 | }
|
425 | 425 | var literalString = trimLeft(stream.slice(start, this.current));
|
426 | 426 | literalString = literalString.replace("\\`", "`");
|
427 |
| - if (this.looksLikeJSON(literalString)) { |
| 427 | + if (this.__looksLikeJSON(literalString)) { |
428 | 428 | literal = JSON.parse(literalString);
|
429 | 429 | } else {
|
430 | 430 | // Try to JSON parse it as "<literal>"
|
|
435 | 435 | return literal;
|
436 | 436 | },
|
437 | 437 |
|
438 |
| - looksLikeJSON: function(literalString) { |
| 438 | + __looksLikeJSON: function(literalString) { |
439 | 439 | var startingChars = "[{\"";
|
440 | 440 | var jsonLiterals = ["true", "false", "null"];
|
441 | 441 | var numberLooking = "-0123456789";
|
|
0 commit comments