-
Notifications
You must be signed in to change notification settings - Fork 37
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
Allow &synchronized with static length fields and not just literals #1830
Comments
This example should be doable, but one note to double-check: I don't think it'd work with look-ahead but would need to do a direct match on the literal. I.e, it wouldn't work if there were more units each having some static length fields before their literals. That's because for look-ahead, the candidate literals all need to start at the same location. However, it might be workable if all static length fields are the same size, need to see. That ok? |
I'm not sure I understand what you're asking? It sounds like I may need to double check my example to see how close it is to the scenario I'm encountering in the parser. I was aiming for a kind of similar parser here but cut down as far as I could. |
Here is a version of what I meant. In addition to your example,I think (hope ...) we could also support the following:
However, if we replace the (This might actually be even more relevant for normal look-ahead parsing than error recovery, but it's all the same machinery.) |
Ah, thanks for the explanation. I'm not sure that if that different width header thing would bite us (the 8/64 thing you pointed out) but my initial gut feeling is that eventually it would. I did just create a work around for this issue, but it's truly awful although perhaps better than the existing attempt.
The approach might not be all that surprising, this just can't be any sort of long term solution. :) I suspect I will be prodding more about supporting the 8/64 issue though, that does seem fairly important as I think about it more. Unfortunately I don't have a good sense yet of how hard that would be to support. |
I'm starting to think maybe we could support it, though it might not fit well with the current machinery. Need to think more about how we would implement it. Btw, this started out by you pointing out that that the docs are explaining a recovery mechanism that's not implemented. I believe what this ticket describes is a different case though: the case in the docs just jumps forward to a certain offset, it doesn't necessarily need to find a literal there then. |
Heh, yes. Just having that documented mechanism work would be great. I suppose I shouldn't distract in this ticket by getting greedy and asking for more. :) |
Some protocols have static length fields before the literal where we might use the &synchronize attribute but currently spicy only allows literals before the literal where &synchronize is used.
Here is a toy parser that should illustrate what I would like to be able to do...
This currently give this error....
The text was updated successfully, but these errors were encountered: