You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I get unexpected column values when parsing a JSON file.
Have a look at the following code.
For example: I expect value 3 to have a column value of 78, but the tool reports 65
import * as c from "clarinet"
const { Readable } = require('stream')
// 1 2 3 4 5 6 7 8
//.4.6.8.0.2.4.6.8.0.2.4.6.8.0.2.4.6.8.0.2.4.6.8.0.2.4.6.8.0.2.4.6.8.0.2.4.6.8.0
const readable = Readable.from([`{
"a0": "x",
"b0": "x", "b1": 0, "b2": "", "b3": "", "b4": "", "b5": 1, "b6": 2, "b7": 3
}`])
var parse_stream = c.createStream()
parse_stream.on('openobject', function (name: string) {
console.log("openobj", name, "*", `${parse_stream._parser.line}:${parse_stream._parser.column}`, parse_stream._parser.position)
});
parse_stream.on('key', function (name: string) {
console.log("key", name, "*", `${parse_stream._parser.line}:${parse_stream._parser.column}`, parse_stream._parser.position)
});
parse_stream.on('string', function (name: string) {
console.log("string", name, "*", `${parse_stream._parser.line}:${parse_stream._parser.column}`, parse_stream._parser.position)
});
parse_stream.on('value', function (value: string) {
console.log("value", value, "*", `${parse_stream._parser.line}:${parse_stream._parser.column}`, parse_stream._parser.position)
});
// parse_stream.on('end', function () {
// console.log("nu end", `${parse_stream._parser.line}:${parse_stream._parser.column}`, parse_stream._parser.position)
// });
readable.pipe(parse_stream);
/*
output:
openobj a0 * 2:6 10
value x * 2:10 15
key b0 * 3:6 24
value x * 3:10 29
key b1 * 3:14 35
value 0 * 3:17 38
key b2 * 3:22 45
value * 3:26 49
key b3 * 3:30 55
value * 3:34 59
key b4 * 3:38 65
value * 3:42 69
key b5 * 3:46 75
value 1 * 3:49 78
key b6 * 3:54 85
value 2 * 3:57 88
key b7 * 3:62 95
value 3 * 3:65 98
*/
The text was updated successfully, but these errors were encountered:
I have decided to fork clarinet into 'bass-clarinet' (the name 'Oboe' was already taken, so that does not leave a lot of instruments left :) )
In that fork I fixed the issue
@BrightSoul please have a look at the following commits: 18a9368 27857cf
(but I guess that you tried out my package, so maybe this is not relevant anymore)
I get unexpected column values when parsing a JSON file.
Have a look at the following code.
For example: I expect value 3 to have a column value of 78, but the tool reports 65
The text was updated successfully, but these errors were encountered: