-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Contemplate a way to trace each part of the parsed output back to the original SDP #125
Comments
Line numbers come to my mind as the obvious way to link. The parser has a knowledge of line numbers up to a certain point, after which it drops that information. Adding line numbers to everything would probably require to put:
The first option appears to be more elegant, but breaks existing APIs quite a bit. The second option would not break the APIs quite as badly, but requires to make changes to a lot of code. |
I think all options will be fairly code change intensive. I personally like the second option better for a few reasons. 1) I think it will result in a more usable API in which the data is directly available on the related object, 2) you can hold on to only the parts of the parse tree you need after parsing, 3) it would present a simpler FFI interface. A trait for the parsed objects could return a ParseContext struct containing the line number. A third approach on the same order of invasivity, is to change the parser to a push parser, so that instead of getting a parsed structure back you get a series of parsing events which can contain their context. Thoughts? |
How granular would the events be? Per m-section, or per line, or...? |
The use of callbacks is the way I have seen push parsers done in the past. It may actually be a fairly simple FFI. As time has passed, I think I like option 2 more and more. Push parsing would require far more boiler plate code. |
In order to facilitate debugging the output of the parser should be correlated somehow with the source.
The text was updated successfully, but these errors were encountered: