fix: add scoped error logging for lexer/parser errors

- Add std.log.scoped(.pugz) to template.zig and view_engine.zig
- Log detailed error info (code, line, column, message) when parsing fails
- Log template path context in ViewEngine on parse errors
- Remove debug print from lexer, use proper scoped logging instead
- Move benchmarks, docs, examples, playground, tests out of src/ to project root
- Update build.zig and documentation paths accordingly
- Bump version to 0.3.1
This commit is contained in:
2026-01-25 17:10:02 +05:30
parent 9d3b729c6c
commit aaf6a1af2d
1148 changed files with 57 additions and 330 deletions

View File

@@ -52,11 +52,9 @@ Source → Lexer → Tokens → StripComments → Parser → AST → Linker →
### Test Files
- **src/tests/general_test.zig** - Comprehensive integration tests
- **src/tests/doctype_test.zig** - Doctype-specific tests
- **src/tests/check_list_test.zig** - Template output validation tests
- **src/lexer_test.zig** - Lexer unit tests
- **src/parser_test.zig** - Parser unit tests
- **tests/general_test.zig** - Comprehensive integration tests
- **tests/doctype_test.zig** - Doctype-specific tests
- **tests/check_list_test.zig** - Template output validation tests
## API Usage
@@ -336,27 +334,26 @@ Uses error unions with detailed `PugError` context including line, column, and s
## File Structure
```
src/
├── root.zig # Public library API
├── view_engine.zig # High-level ViewEngine
├── pug.zig # Main entry point (static compilation)
├── template.zig # Data binding renderer
├── lexer.zig # Tokenizer
├── lexer_test.zig # Lexer tests
├── parser.zig # AST parser
├── parser_test.zig # Parser tests
├── runtime.zig # Shared utilities
├── error.zig # Error formatting
├── walk.zig # AST traversal
├── strip_comments.zig # Comment filtering
├── load.zig # File loading
├── linker.zig # Template inheritance
├── codegen.zig # HTML generation
├── src/ # Source code
├── root.zig # Public library API
├── view_engine.zig # High-level ViewEngine
├── pug.zig # Main entry point (static compilation)
├── template.zig # Data binding renderer
├── lexer.zig # Tokenizer
│ ├── parser.zig # AST parser
│ ├── runtime.zig # Shared utilities
│ ├── error.zig # Error formatting
│ ├── walk.zig # AST traversal
│ ├── strip_comments.zig # Comment filtering
│ ├── load.zig # File loading
│ ├── linker.zig # Template inheritance
│ └── codegen.zig # HTML generation
├── tests/ # Integration tests
│ ├── general_test.zig
│ ├── doctype_test.zig
│ └── check_list_test.zig
── benchmarks/ # Performance benchmarks
├── bench_v1.zig
└── bench_interpreted.zig
── benchmarks/ # Performance benchmarks
├── docs/ # Documentation
├── examples/ # Example templates
└── playground/ # Development playground
```