This commit completes the migration started in the previous commit, updating all remaining files: - Lexer: Changed token from Extends to Modifies - Parser: Updated lalrpop grammar rules and AST field names - AST: Renamed Schedule.extends field to modifies - Grammar: Updated tree-sitter grammar.js - Tree-sitter: Regenerated parser.c and node-types.json - Examples: Updated baker-family work schedules - Tests: Updated schedule composition tests and corpus - Docs: Updated all reference documentation and tutorials - Validation: Updated error messages and validation logic - Package: Bumped version to 0.3.1 in all package manifests All 554 tests pass.
56 lines
1.4 KiB
Plaintext
56 lines
1.4 KiB
Plaintext
//! Work schedules for the Baker family
|
|
//!
|
|
//! Demonstrates schedule composition features:
|
|
//! - modifies keyword for schedule inheritance
|
|
//! - override blocks to modify inherited schedules
|
|
//! - Named blocks for override system
|
|
//! - Action references to behavior trees
|
|
//! - Recurrence patterns for weekly variations
|
|
|
|
// Base work schedule (9-5 job)
|
|
schedule WorkWeek {
|
|
block morning_prep { 08:00 -> 09:00, action:MorningPrep }
|
|
block work { 09:00 -> 17:00, action:DailyWork }
|
|
block evening_rest { 18:00 -> 22:00, action:Resting }
|
|
}
|
|
|
|
// Baker's schedule modifies WorkWeek
|
|
schedule BakerSchedule modifies WorkWeek {
|
|
// Bakers start early - override the work block
|
|
override work {
|
|
05:00 -> 13:00
|
|
action:BakingWork
|
|
intensity:"high"
|
|
}
|
|
|
|
// Add pre-dawn prep
|
|
block pre_dawn_prep {
|
|
04:00 -> 05:00
|
|
action:PrepKitchen
|
|
}
|
|
|
|
// Market day on Saturdays
|
|
recurrence MarketDay on Saturday {
|
|
block market {
|
|
06:00 -> 14:00
|
|
action:SellAtMarket
|
|
place:"town_square"
|
|
}
|
|
}
|
|
}
|
|
|
|
// Assistant baker schedule (helps during busy times)
|
|
schedule AssistantSchedule modifies BakerSchedule {
|
|
// Assistant comes in later
|
|
override work {
|
|
06:00 -> 14:00
|
|
action:AssistWithBaking
|
|
}
|
|
|
|
// Assistant does a quick prep before work
|
|
override pre_dawn_prep {
|
|
05:30 -> 06:00
|
|
action:QuickPrep
|
|
}
|
|
}
|