## Critical Fixes Implemented ### 1. Memory Leak Resolution - Fixed doc comment allocation in peekDocComment() to properly allocate memory - Added cleanup for pending_doc_comment when skipping lines - All tests now run with zero memory leaks (GPA verified) ### 2. Flag Definition Parsing (CRITICAL) - Added skipWhitespace() helper to handle newlines before #define statements - Flag structures now properly populated with all fields - Before: empty structs with only padding - After: all 7 flags present in GPUTextureUsageFlags ### 3. Invalid Identifier Generation (CRITICAL) - Implemented "first underscore" naming rule - Prevents enum values starting with numbers (e.g., 16bit, 2d) - detectCommonPrefix() now only strips SDL_GPU_/SDL_ prefix - enumValueToZig() splits on first underscore to preserve type prefix ### 4. Naming Convention Alignment - Changed from "last underscore" to "first underscore" rule - Type part: all lowercase (e.g., primitivetype) - Value part: TitleCamelCase (e.g., Trianglelist) - Result: primitivetypeTrianglelist (matches existing codebase) - Added screaminToTitleCamel() helper for proper camelCase conversion ## Test Coverage ### New Tests Added - patterns.zig: 3 new tests for flag scanning with whitespace - naming.zig: 10 new comprehensive tests for naming conventions - All 18 unit tests passing - Integration test with SDL_gpu.h successful (169 declarations) ### Files Modified 1. **patterns.zig** - Added skipWhitespace() helper (lines 609-618) - Updated scanFlagTypedef() to skip whitespace before #define - Added 3 new flag scanning tests 2. **naming.zig** - Rewrote detectCommonPrefix() to only strip SDL prefix - Rewrote enumValueToZig() with first underscore rule - Added screaminToTitleCamel() helper - Added 10 comprehensive naming tests 3. **parser.zig** - Previous memory leak fixes intact - No changes needed for this iteration ## Documentation Added 1. **PARSER_FIX_PLAN.md** - Detailed implementation plan 2. **IMPLEMENTATION_COMPLETE.md** - Summary of fixes and results 3. **TEST_HARNESS_PLAN.md** - Original test harness design 4. **TEST_HARNESS_PLAN_V2.md** - Enhanced plan with mock generation ## Verification ✅ Parser generates valid Zig code (no compilation errors) ✅ All flag fields populated correctly ✅ No invalid identifiers (no numeric prefixes) ✅ Naming matches existing codebase conventions ✅ All 18 unit tests passing ✅ No memory leaks (GPA verified) ✅ Successfully parsed SDL_gpu.h (169 declarations) ## Next Steps (Planned) - Implement mock_codegen.zig for C stub generation - Create test_project/ with complete build system - Add function call coverage tests - Implement golden file regression testing 🤖 Generated with Claude Code (https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> |
||
|---|---|---|
| .github/workflows | ||
| archive | ||
| build | ||
| buildgen | ||
| depot | ||
| docs | ||
| engine | ||
| extras | ||
| lib | ||
| projects | ||
| testing | ||
| tools | ||
| .gitattributes | ||
| .gitignore | ||
| .gitmodules | ||
| CLAUDE.md | ||
| LICENSE | ||
| README.md | ||
| build.archive.zig | ||
| build.zig | ||
| build.zig.zon | ||
| content.txt | ||
| todo.txt | ||
README.md
Backlog
zig version: 0.15.1
Backlog Labs Game Engine.
Getting Started
run tools/scripts/first-time-setup.py
ffmpeg -i INPUT.mp4 -c:v libtheora -q:v 7 -c:a libvorbis -q:a 4 OUTPUT.ogv
git-bug Cheat Sheet
This project uses git-bug for distributed issue tracking. Issues are stored directly in the repository.
Common Commands
Listing Issues
git bug bug # List all issues
git bug bug status:open # List only open issues
git bug bug status:closed # List only closed issues
Creating Issues
git bug bug new -t "title" -m "message" # Create new issue
git bug bug new -t "Add feature X" -m "Description" # Example
Viewing & Managing Issues
git bug bug show <id> # Show issue details
git bug bug comment <id> # Add a comment to an issue
git bug bug close <id> # Close an issue
git bug bug open <id> # Reopen an issue
git bug bug status <id> # Show issue status
Labels
git bug bug label <id> # Show labels for an issue
git bug bug label new <id> <label> # Add a label
git bug bug label rm <id> <label> # Remove a label
Syncing
git bug pull # Pull issue updates from remote
git bug push # Push issue updates to remote
Standard Labels
Component Labels: core, rendering, physics, build-system, platform, assets, audio, ui, documentation
Type Labels:
bug- Defects or incorrect behaviorfeature- New functionalityenhancement- Improvements to existing featurestask- General development workdocumentation- Documentation improvementsquestion- Design decisions or discussionsrefactoring- Code cleanup
Problem Type Labels (for bugs):
memory- Memory issuesthreading- Concurrency issuescrash- Application crashesbuild- Build system issues
Quick Examples
# Create a bug report
git bug bug new -t "Memory leak in asset loader" -m "Assets not freed when unloading scenes"
git bug bug label new <id> bug assets memory
# Create a feature request
git bug bug new -t "Add terrain generation" -m "Implement heightmap-based terrain"
git bug bug label new <id> feature rendering
# Create a task
git bug bug new -t "Update to Zig 0.15" -m "Migrate to latest Zig version"
git bug bug label new <id> task build-system
# View and comment on an issue
git bug bug show abc123
git bug bug comment abc123
Tips
- Issue IDs can be abbreviated (first few characters)
- Use
--non-interactiveflag for scripting - Issues sync with
git bug pull/push - Keep descriptions factual and clear