{
struct json_token token;
- p->byte_number++;
- if (c == '\n') {
- p->column_number = 0;
- p->line_number++;
- } else {
- p->column_number++;
- }
-
switch (p->lex_state) {
case JSON_LEX_START:
switch (c) {
size_t i;
for (i = 0; !p->done && i < n; ) {
if (json_lex_input(p, input[i])) {
+ p->byte_number++;
+ if (input[i] == '\n') {
+ p->column_number = 0;
+ p->line_number++;
+ } else {
+ p->column_number++;
+ }
i++;
}
}
-# Copyright (c) 2010, 2011 Nicira Networks
+# Copyright (c) 2010, 2011, 2012 Nicira Networks
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
return True
def __lex_input(self, c):
- self.byte_number += 1
- if c == '\n':
- self.column_number = 0
- self.line_number += 1
- else:
- self.column_number += 1
-
eat = self.lex_state(self, c)
assert eat is True or eat is False
return eat
while True:
if self.done or i >= len(s):
return i
- if self.__lex_input(s[i]):
+
+ c = s[i]
+ if self.__lex_input(c):
+ self.byte_number += 1
+ if c == '\n':
+ self.column_number = 0
+ self.line_number += 1
+ else:
+ self.column_number += 1
+
i += 1
def is_done(self):
file: read: [0]
file: read: [1]
file: read: [2]
-file: read failed: syntax error: file: 5 bytes starting at offset 228 are not valid JSON (line 1, column 0, byte 5: syntax error at beginning of input)
+file: read failed: syntax error: file: 5 bytes starting at offset 228 are not valid JSON (line 0, column 4, byte 4: syntax error at beginning of input)
file: write:["replacement data"] successful
]], [ignore])
AT_CHECK(