Files
storybook/tests/examples/validation_errors.sb
Sienna Meridian Satterwhite 9c20dd4092 feat: implement storybook DSL with template composition and validation
Add complete domain-specific language for authoring narrative content for
agent simulations.

Features:
- Complete parser using LALRPOP + logos lexer
- Template composition (includes + multiple inheritance)
- Strict mode validation for templates
- Reserved keyword protection
- Semantic validators (trait ranges, schedule overlaps, life arcs, behaviors)
- Name resolution and cross-reference tracking
- CLI tool (validate, inspect, query commands)
- Query API with filtering
- 260 comprehensive tests (unit, integration, property-based)

Implementation phases:
- Phase 1 (Parser): Complete
- Phase 2 (Resolution + Validation): Complete
- Phase 3 (Public API + CLI): Complete

BREAKING CHANGE: Initial implementation
2026-02-08 13:24:35 +00:00

55 lines
1.1 KiB
Plaintext

// Test semantic validation errors
// Valid bond values (should parse and validate)
relationship GoodFriendship {
Alice
Bob
bond: 0.8
}
// Invalid bond value - too high (should validate with error)
// relationship BadFriendship1 {
// Carol
// David
// bond: 1.5 // Error: bond > 1.0
// }
// Invalid bond value - negative (should validate with error)
// relationship BadFriendship2 {
// Elena
// Frank
// bond: -0.1 // Error: bond < 0.0
// }
// Valid age
character YoungPerson {
age: 25
}
// Invalid age - negative (commented to allow file to parse)
// character InvalidPerson1 {
// age: -5 // Error: age < 0
// }
// Invalid age - too high (commented to allow file to parse)
// character InvalidPerson2 {
// age: 200 // Error: age > 150
// }
// Valid life arc with proper transitions
life_arc ValidLifeArc {
state start {
on ready -> end
}
state end {
// Terminal state
}
}
// Invalid life arc - transition to non-existent state (commented)
// life_arc InvalidLifeArc {
// state start {
// on ready -> nonexistent // Error: state 'nonexistent' not defined
// }
// }