38 lines
827 B
Plaintext
38 lines
827 B
Plaintext
|
|
// Test use statement syntax
|
||
|
|
// Note: Multi-file resolution not yet implemented,
|
||
|
|
// but syntax is parsed and validated
|
||
|
|
|
||
|
|
// Single import - import one specific item
|
||
|
|
use characters::Martha;
|
||
|
|
use templates::GenericPerson;
|
||
|
|
use enums::BondType;
|
||
|
|
|
||
|
|
// Grouped import - import multiple items from same module
|
||
|
|
use characters::{David, Tommy, Elena};
|
||
|
|
use behaviors::{WorkAtBakery, SocialInteraction, DailyRoutine};
|
||
|
|
|
||
|
|
// Wildcard import - import everything from a module
|
||
|
|
use locations::*;
|
||
|
|
use schedules::*;
|
||
|
|
|
||
|
|
// Nested paths work too
|
||
|
|
use world::characters::npcs::Merchant;
|
||
|
|
use schema::core::needs::Hunger;
|
||
|
|
|
||
|
|
// After imports, define local declarations
|
||
|
|
character LocalCharacter {
|
||
|
|
age: 25
|
||
|
|
name: "Local Person"
|
||
|
|
}
|
||
|
|
|
||
|
|
template LocalTemplate {
|
||
|
|
age: 20..60
|
||
|
|
energy: 0.5..1.0
|
||
|
|
}
|
||
|
|
|
||
|
|
enum LocalEnum {
|
||
|
|
option_a,
|
||
|
|
option_b,
|
||
|
|
option_c
|
||
|
|
}
|