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
It would be nice to make the trait to implement for meta parsing and composing as simple as possible. To achieve this one probably wants to eliminate the state. The overall idea of the design is separating the state such that roll backs are a natural side effect of performing an operation on an earlier state.
Concepts
Rule is an object that controls how a document is parsed and composed
A meta parser or composer uses sub rules and be a rule itself
Meta reader is an object implementing MetaReader which is the receiver of meta data from a meta parser. The meta reader communicates with the meta parser, such that error messages are handled as early as possible.
Meta writer is an object implementing MetaWriter which is the sender of meta data to a meta composer. The meta writer receives output character ranges from the meta composer such that error messages can be linked to the original source through mapping.
A state is an object associated with the meta reader or writer. For a reader it tells where to put data in the output structure. For a writer it tells where to read from in the input structure. When jumping back to an earlier state, it means the parsing or composing was rolled back because a rule failed. This must be handled by the meta reader or writer.
There is no need for a centralized meta parser or composer, if we can split it into objects that represents the rules and then pass along the state.
The state needed for parsing is chars: &[char], offset: usize.
It would be nice to make the trait to implement for meta parsing and composing as simple as possible. To achieve this one probably wants to eliminate the state. The overall idea of the design is separating the state such that roll backs are a natural side effect of performing an operation on an earlier state.
Concepts
MetaReader
which is the receiver of meta data from a meta parser. The meta reader communicates with the meta parser, such that error messages are handled as early as possible.MetaWriter
which is the sender of meta data to a meta composer. The meta writer receives output character ranges from the meta composer such that error messages can be linked to the original source through mapping.There is no need for a centralized meta parser or composer, if we can split it into objects that represents the rules and then pass along the state.
The state needed for parsing is
chars: &[char], offset: usize
.Semantics
The semantics using the notation PistonDevelopers/piston#736 :
The text was updated successfully, but these errors were encountered: