Lines Matching refs:buffer

88 proto.charError = function (buffer, i) {
90 this.onError(new Error("Unexpected " + JSON.stringify(String.fromCharCode(buffer[i])) + " at position " + i + " in state " + Parser.toknam(this.tState)));
127 proto.write = function (buffer) {
128 if (typeof buffer === "string") buffer = new Buffer(buffer);
130 for (var i = 0, l = buffer.length; i < l; i++) {
132 n = buffer[i];
154 return this.charError(buffer, i);
158 n = buffer[i]; // get current byte from buffer
160 // & fill temp buffer it with start of this data chunk up to the boundary limit set in the last iteration
163 this.temp_buffs[this.bytes_in_sequence][this.bytes_in_sequence - this.bytes_remaining + j] = buffer[j];
176 if ((this.bytes_in_sequence + i) > buffer.length) { // if bytes needed to complete char fall outside buffer length, we have a boundary split
177 for (var k = 0; k <= (buffer.length - 1 - i); k++) {
178 this.temp_buffs[this.bytes_in_sequence][k] = buffer[i + k]; // fill temp buffer of correct size with bytes available in this chunk
180 this.bytes_remaining = (i + this.bytes_in_sequence) - buffer.length;
181 i = buffer.length - 1;
183 this.appendStringBuf(buffer, i, i + this.bytes_in_sequence);
199 return this.charError(buffer, i);
202 n = buffer[i];
213 return this.charError(buffer, i);
216 n = buffer[i];
238 return this.charError(buffer, i);
241 n = buffer[i];
267 return this.charError(buffer, i);
283 if (buffer[i] === 0x72) { this.tState = TRUE2; }
284 else { return this.charError(buffer, i); }
286 if (buffer[i] === 0x75) { this.tState = TRUE3; }
287 else { return this.charError(buffer, i); }
289 if (buffer[i] === 0x65) { this.tState = START; this.onToken(TRUE, true); this.offset+= 3; }
290 else { return this.charError(buffer, i); }
292 if (buffer[i] === 0x61) { this.tState = FALSE2; }
293 else { return this.charError(buffer, i); }
295 if (buffer[i] === 0x6c) { this.tState = FALSE3; }
296 else { return this.charError(buffer, i); }
298 if (buffer[i] === 0x73) { this.tState = FALSE4; }
299 else { return this.charError(buffer, i); }
301 if (buffer[i] === 0x65) { this.tState = START; this.onToken(FALSE, false); this.offset+= 4; }
302 else { return this.charError(buffer, i); }
304 if (buffer[i] === 0x75) { this.tState = NULL2; }
305 else { return this.charError(buffer, i); }
307 if (buffer[i] === 0x6c) { this.tState = NULL3; }
308 else { return this.charError(buffer, i); }
310 if (buffer[i] === 0x6c) { this.tState = START; this.onToken(NULL, null); this.offset += 3; }
311 else { return this.charError(buffer, i); }