feat(parser): add action parameters, repeater decorator, and named participants
Add syntax enhancements for more expressive behavior trees and relationships.
Action parameters:
- Support typed/positional parameters: WaitDuration(2.0)
- Support named parameters: SetValue(field: value)
- Enable inline values without field names
Repeater decorator:
- Add * { node } syntax for repeating behavior nodes
- Maps to Decorator("repeat", node)
Named participant blocks:
- Replace self/other blocks with named participant syntax
- Support multi-party relationships
- Example: Alice { role: seeker } instead of self { role: seeker }
Schedule block syntax:
- Require braces for schedule blocks to support narrative fields
- Update tests to use new syntax: 04:00 -> 06:00: Activity { }
This commit is contained in:
@@ -33,6 +33,7 @@ pub enum ResolvedDeclaration {
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ResolvedCharacter {
|
||||
pub name: String,
|
||||
pub species: Option<String>,
|
||||
pub fields: Vec<Field>,
|
||||
pub span: Span,
|
||||
/// Qualified path (e.g., characters::Martha)
|
||||
|
||||
@@ -419,6 +419,7 @@ mod tests {
|
||||
states: vec![
|
||||
ArcState {
|
||||
name: "start".to_string(),
|
||||
on_enter: None,
|
||||
transitions: vec![Transition {
|
||||
to: "end".to_string(),
|
||||
condition: Expr::Identifier(vec!["ready".to_string()]),
|
||||
@@ -428,6 +429,7 @@ mod tests {
|
||||
},
|
||||
ArcState {
|
||||
name: "end".to_string(),
|
||||
on_enter: None,
|
||||
transitions: vec![],
|
||||
span: Span::new(50, 100),
|
||||
},
|
||||
@@ -446,6 +448,7 @@ mod tests {
|
||||
name: "Test".to_string(),
|
||||
states: vec![ArcState {
|
||||
name: "start".to_string(),
|
||||
on_enter: None,
|
||||
transitions: vec![Transition {
|
||||
to: "nonexistent".to_string(),
|
||||
condition: Expr::Identifier(vec!["ready".to_string()]),
|
||||
|
||||
@@ -161,6 +161,7 @@ proptest! {
|
||||
states: vec![
|
||||
ArcState {
|
||||
name: state1_name.clone(),
|
||||
on_enter: None,
|
||||
transitions: vec![Transition {
|
||||
to: state2_name.clone(),
|
||||
condition: Expr::BoolLit(true),
|
||||
@@ -170,6 +171,7 @@ proptest! {
|
||||
},
|
||||
ArcState {
|
||||
name: state2_name,
|
||||
on_enter: None,
|
||||
transitions: vec![],
|
||||
span: Span::new(50, 100),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user