Expand description
Command structures for KoiLang parsing
This module defines the data structures used to represent parsed commands and their arguments in a unified format. Commands are the fundamental building blocks of KoiLang files, representing actions, text content, and annotations.
§Core Types
Value- Basic value types (integers, floats, strings)CompositeValue- Complex value types (lists, dictionaries)Parameter- Command parameters that can be basic or compositeCommand- Complete commands with name and parameters
§Examples
use koicore::command::{Command, Parameter, Value, CompositeValue};
// Create a simple command
let cmd = Command::new("character", vec![
Parameter::from("Alice"),
Parameter::from("Hello, world!")
]);
// Create a command with composite parameters
let cmd = Command::new("action", vec![
Parameter::from(("type", "walk")),
Parameter::from(("direction", "left")),
Parameter::Composite("speed".to_string(), CompositeValue::Single(Value::Int(5)))
]);
// Create text and annotation commands
let text_cmd = Command::new_text("Hello, world!");
let annotation_cmd = Command::new_annotation("This is an annotation");Structs§
- Command
- Represents a complete KoiLang command
Enums§
- Composite
Value - Composite value types that can contain multiple basic values
- Parameter
- Command parameter types
- Value
- Basic value types supported by KoiLang