Comparing version 0.5.4 to 0.5.5
@@ -132,3 +132,3 @@ ;(function (clarinet) { | ||
parser.bufferCheckPosition = clarinet.MAX_BUFFER_LENGTH; | ||
parser.q = parser.c = ""; | ||
parser.q = parser.c = parser.p = ""; | ||
parser.opt = opt || {}; | ||
@@ -274,6 +274,13 @@ parser.closed = parser.closedRoot = parser.sawRoot = false; | ||
if (chunk === null) return end(parser); | ||
var i = 0, c = chunk[0]; | ||
var i = 0, c = chunk[0], p = parser.p; | ||
if (clarinet.DEBUG) console.log('write -> [' + chunk + ']'); | ||
while (c) { | ||
p = c; | ||
parser.c = c = chunk.charAt(i++); | ||
// if chunk doesnt have next, like streaming char by char | ||
// this way we need to check if previous is really previous | ||
// if not we need to reset to what the parser says is the previous | ||
// from buffer | ||
if(p !== c ) parser.p = p; | ||
else p = parser.p; | ||
@@ -381,3 +388,3 @@ if(!c) break; | ||
var starti = i-1 | ||
, consecutive_slashes = 0 | ||
, consecutive_slashes = parser.consecutive_slashes || 0 | ||
, gaps = new fastlist() | ||
@@ -403,3 +410,6 @@ ; | ||
} | ||
else consecutive_slashes = 0; | ||
else { | ||
consecutive_slashes = 0; | ||
} | ||
parser.consecutive_slashes = consecutive_slashes; | ||
parser.position ++; | ||
@@ -415,4 +425,4 @@ if (c === "\n") { | ||
; | ||
while(e) { | ||
parser.textNode += chunk.substring(s, e); | ||
while(typeof e === 'number') { | ||
parser.textNode += chunk.slice(s, e); | ||
s = e+1; | ||
@@ -509,3 +519,2 @@ e = gaps.shift(); | ||
} else if (c==="+" || c==="-") { | ||
var p = i-2 > 0 ? chunk.charAt(i-2) : ''; | ||
if(!(p==='e' || p==='E')) | ||
@@ -512,0 +521,0 @@ error(parser, 'Invalid symbol in number'); |
@@ -5,3 +5,3 @@ { "name" : "clarinet" | ||
, "author" : "Nuno Job <nunojobpinto@gmail.com> (http://nunojob.com/)" | ||
, "version" : "0.5.4" | ||
, "version" : "0.5.5" | ||
, "main" : "./clarinet.js" | ||
@@ -8,0 +8,0 @@ , "homepage" : "https://github.com/dscape/clarinet" |
@@ -13,3 +13,3 @@ if (!clarinet) { // node | ||
var seps = [undefined, /\t|\n|\r/] | ||
var seps = [undefined, /\t|\n|\r/, ''] | ||
, sep | ||
@@ -16,0 +16,0 @@ , docs = |
39433295
7501