BREAKING CHANGES: - Relationship syntax now requires blocks for all participants - Removed self/other perspective blocks from relationships - Replaced 'guard' keyword with 'if' for behavior tree decorators Language Features: - Add tree-sitter grammar with improved if/condition disambiguation - Add comprehensive tutorial and reference documentation - Add SBIR v0.2.0 binary format specification - Add resource linking system for behaviors and schedules - Add year-long schedule patterns (day, season, recurrence) - Add behavior tree enhancements (named nodes, decorators) Documentation: - Complete tutorial series (9 chapters) with baker family examples - Complete reference documentation for all language features - SBIR v0.2.0 specification with binary format details - Added locations and institutions documentation Examples: - Convert all examples to baker family scenario - Add comprehensive working examples Tooling: - Zed extension with LSP integration - Tree-sitter grammar for syntax highlighting - Build scripts and development tools Version Updates: - Main package: 0.1.0 → 0.2.0 - Tree-sitter grammar: 0.1.0 → 0.2.0 - Zed extension: 0.1.0 → 0.2.0 - Storybook editor: 0.1.0 → 0.2.0
67 lines
1.6 KiB
Rust
67 lines
1.6 KiB
Rust
//! Quick parser test to debug parsing issues
|
|
|
|
#[cfg(test)]
|
|
mod tests {
|
|
use crate::lsp::document::Document;
|
|
|
|
#[test]
|
|
fn test_simple_character() {
|
|
let input = "character Alice { age: 7 }";
|
|
let doc = Document::new(input.to_string());
|
|
|
|
println!("Parse errors: {:?}", doc.parse_errors);
|
|
if doc.ast.is_some() {
|
|
println!("SUCCESS: Parsed AST");
|
|
} else {
|
|
println!("FAILED: No AST produced");
|
|
}
|
|
|
|
assert!(doc.ast.is_some(), "Should parse simple character");
|
|
assert!(doc.parse_errors.is_empty(), "Should have no parse errors");
|
|
}
|
|
|
|
#[test]
|
|
fn test_species_first() {
|
|
let input = r#"
|
|
species Human {
|
|
intelligence: high
|
|
}
|
|
|
|
character Alice: Human {
|
|
age: 7
|
|
}
|
|
"#;
|
|
let doc = Document::new(input.to_string());
|
|
|
|
if !doc.parse_errors.is_empty() {
|
|
for err in &doc.parse_errors {
|
|
eprintln!("Parse error: {}", err.message);
|
|
}
|
|
}
|
|
|
|
assert!(doc.ast.is_some(), "Should parse species and character");
|
|
assert!(doc.parse_errors.is_empty(), "Should have no parse errors");
|
|
}
|
|
|
|
#[test]
|
|
fn test_with_prose() {
|
|
let input = r#"
|
|
character Alice {
|
|
age: 7
|
|
---backstory
|
|
A curious girl
|
|
---
|
|
}
|
|
"#;
|
|
let doc = Document::new(input.to_string());
|
|
|
|
if !doc.parse_errors.is_empty() {
|
|
for err in &doc.parse_errors {
|
|
eprintln!("Parse error: {}", err.message);
|
|
}
|
|
}
|
|
|
|
assert!(doc.ast.is_some(), "Should parse character with prose");
|
|
}
|
|
}
|