This commit is contained in:
2021-06-23 17:21:03 -06:00
parent a813475a41
commit 7f0816eb1c
4 changed files with 156 additions and 20 deletions

View File

@@ -3,21 +3,26 @@ package nat;
import kiss.Prelude;
import kiss.List;
import kiss.Operand;
import haxe.Constraints;
enum CommandArgument {
enum CommandArgType {
SelectedEntry;
SelectedEntries(min:Null<Int>, max:Null<Int>);
Text(minLength:Null<Int>, maxLength:Null<Int>);
Text(minLength:Null<Int>, maxLength:Null<Float>); // max length is a float so Math.POSITIVE_INFINITY can be used
Number(min:Null<Float>, max:Null<Float>, inStepsOf:Null<Float>);
Entry;
OneEntry; // This constructor must be disambiguated from the typedef "Entry"
Entries(min:Null<Int>, max:Null<Int>);
}
typedef CommandArg = {
name:String,
type:CommandArgType
};
typedef Command = {
args:Array<CommandArgument>,
args:Array<CommandArg>,
handler:Function
// Command handlers need to return a ChangeSet
};
typedef ChangeSet = Array<Entry>;