-
Notifications
You must be signed in to change notification settings - Fork 48
Description
I'm sure I'm missing something very obvious here, but I started using this package and thought it was exactly what I wanted until I noticed that the "lines" it prints are not actually lines from the source. For example, I write this YAML:
input_alphabet: [0, 1]
start_state: q0
accept_states: [q0]
delta:
q0:
0: q0
1: q1
and because it is missing a required field states
, the error message prints
REQUIRED Missing required field - DFA must have: states, input_alphabet, start_state, accept_states, delta
> 1 | {
| ^ ☹️ states is missing here!
2 | "input_alphabet": [
3 | "0",
4 | "1"
Note in particular that the "file" is not the actual parsed file, but a re-created JSON with extra newlines (originally there is one line input_alphabet: [0, 1]
but now there are four lines specifying that property).
I realize I'm using this to parse YAML, not JSON, but presumably this would also plague JSON files unless they happened to choose to have the exact same whitespace as in the reconstructed JSON.
I thought I must be missing something obvious, because I cannot possibly see the point of carefully pointing the user to the precise line and column where the error occurred, in a fake file whose line numbers are completely different from the line numbers of the actual original source that they typed.