Skip to content

Add Escape Sequences and Other Prerequisites

recite1670 requested to merge feature/escape-sequences into master

Adds a few key features, all of which are API breaking of course.

Execution Contexts

Replaces consoles.
The issue with generic data is that the data must be passed if need be, and must not be passed if need not. This creates a requirement for lesser data to be assignable from greater data, which in some cases requires custom conversions, and requires terrible boilerplate if the feature is not even used.
Execution contexts serve to remove that issue altogether. The data is fed in via an implementation, and an instance of an interface (or implementation) is passed to the commands in case they need to call more commands (method provided by interface) or get data (field/property provided by implementation). This means all commands now accept context instead of data, but the context loosens the references and boilerplate needed in case the data is not needed.

Interpolators

Interpolators act as a one-stop-shop for escape sequences and future substitution features, such as command substitution. Their whole purpose is to interpolate the raw input of the user.
In cases where multiple interpolators must be used, they can be layered on top of each other by piping the result of the first interpolator in the next, and the next, and so on. An implementation of this has been provided via AggregateInterpolator<TContext>, and because it is an interpolator itself, another aggregation can be performed if needed to get an interpolator tree (although, there isn't much of a benefit to it aside from sounding cool and looking cool when diagrammed).

Escape Sequences

Escape sequences are an abstract implementation of an interpolator. They have a starting pattern (like \) and the rest is handled by the implementing class.
All of the C# escape sequences

Extension Classes

Extension classes whose sole purpose was converting the generic data from one type to another have been removed because of the great contextualization.
An extension class for IEnumerator<T> was added and is used by some of the new escape sequences to pop values and advance the enumerator in an easy manner.


Closes #6 (closed)

Edited by recite1670

Merge request reports

Loading