I tried finding an example in scanner.zig, but didn’t find any.
I also did see the
To enable diagnostics, declare var diagnostics = Diagnostics{}; then call source.enableDiagnostics(&diagnostics); where source is either a std.json.Reader or a std.json.Scanner that has just been initialized.
but this isn’t helpful enough for me. I’d like to see a full real example.
and json.Scanner can be replaced with a json.Reader without any changes if you have a reader you want to get the json from.
FYI json.Diagnostics contains a pointer used to calculate some of the information, so if you wont to propogate the diagnostic info making my own diagnostic type to contain the results was the nicest solution i found
alternatively you could have the Scanner/Reader created further up but it didnt like that idea in my situation
“SyntaxError” with no other details about exactly what’s wrong with the syntax isn’t very helpful. What’s wrong with that line? In isolation, there’s nothing actually wrong with that line – it’s what comes after that line that makes it an issue on that line. Where on the line is it? Knowing the character offset on the line would be very helpful in understanding what the actual issue is.