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:
@@ -134,12 +134,14 @@ fn test_duplicate_definition_error() {
|
||||
declarations: vec![
|
||||
Declaration::Character(Character {
|
||||
name: "Martha".to_string(),
|
||||
species: None,
|
||||
fields: vec![],
|
||||
template: None,
|
||||
span: Span::new(0, 10),
|
||||
}),
|
||||
Declaration::Character(Character {
|
||||
name: "Martha".to_string(),
|
||||
species: None,
|
||||
fields: vec![],
|
||||
template: None,
|
||||
span: Span::new(20, 30),
|
||||
@@ -207,6 +209,7 @@ fn test_unknown_life_arc_state_error() {
|
||||
states: vec![
|
||||
ArcState {
|
||||
name: "child".to_string(),
|
||||
on_enter: None,
|
||||
transitions: vec![Transition {
|
||||
to: "adult".to_string(), // 'adult' exists
|
||||
condition: Expr::BoolLit(true),
|
||||
@@ -216,6 +219,7 @@ fn test_unknown_life_arc_state_error() {
|
||||
},
|
||||
ArcState {
|
||||
name: "adult".to_string(),
|
||||
on_enter: None,
|
||||
transitions: vec![Transition {
|
||||
to: "senior".to_string(), // 'senior' doesn't exist!
|
||||
condition: Expr::BoolLit(true),
|
||||
@@ -323,6 +327,7 @@ fn test_schedule_overlap_error() {
|
||||
minute: 30,
|
||||
second: 0,
|
||||
},
|
||||
fields: vec![],
|
||||
span: Span::new(0, 50),
|
||||
},
|
||||
ScheduleBlock {
|
||||
@@ -337,6 +342,7 @@ fn test_schedule_overlap_error() {
|
||||
minute: 0,
|
||||
second: 0,
|
||||
},
|
||||
fields: vec![],
|
||||
span: Span::new(50, 100),
|
||||
},
|
||||
],
|
||||
@@ -413,6 +419,7 @@ fn test_relationship_bond_out_of_range() {
|
||||
fn test_duplicate_field_in_convert() {
|
||||
let character = Character {
|
||||
name: "Martha".to_string(),
|
||||
species: None,
|
||||
fields: vec![
|
||||
Field {
|
||||
name: "age".to_string(),
|
||||
|
||||
Reference in New Issue
Block a user