-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
start fleshing out the parser, add some unit tests for sanity
- Loading branch information
1 parent
e40e759
commit 9b8af82
Showing
7 changed files
with
339 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
namespace ConsoleBuffer | ||
{ | ||
public abstract class BaseCommand | ||
{ | ||
internal BaseCommand(string bufferData) | ||
{ | ||
this.Parse(bufferData); | ||
} | ||
|
||
protected abstract void Parse(string bufferData); | ||
} | ||
|
||
public sealed class UnsupportedCommand : BaseCommand | ||
{ | ||
public UnsupportedCommand() : base(null) { } | ||
protected override void Parse(string bufferData) { } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
namespace ConsoleBuffer | ||
{ | ||
public sealed class ControlCharacterCommand : BaseCommand | ||
{ | ||
public enum ControlCode | ||
{ | ||
/// <summary> | ||
/// Not really a command but a notable character we may wish to specially handle (\0 or '^ ') | ||
/// </summary> | ||
NUL = 0, | ||
/// <summary> | ||
/// Beep beep (\a or ^G) | ||
/// </summary> | ||
BEL, | ||
/// <summary> | ||
/// Backspace (\b or ^H) | ||
/// </summary> | ||
BS, | ||
/// <summary> | ||
/// Carriage return (\r or ^M) | ||
/// </summary> | ||
CR, | ||
/// <summary> | ||
/// Form feed (\f or ^L) | ||
/// </summary> | ||
FF, | ||
/// <summary> | ||
/// Line-feed (\n or ^J) | ||
/// </summary> | ||
LF, | ||
/// <summary> | ||
/// Horizontal tab (\t or ^I) | ||
/// </summary> | ||
TAB, | ||
} | ||
|
||
public readonly ControlCode Code; | ||
|
||
public ControlCharacterCommand(ControlCode code) : base(null) | ||
{ | ||
this.Code = code; | ||
} | ||
|
||
protected override void Parse(string bufferData) { } | ||
} | ||
} |
Oops, something went wrong.