feat(phase-2.3): indentation tracking with INDENT/DEDENT tokens#2
Merged
Mjboothaus merged 1 commit intomainfrom Jan 14, 2026
Merged
feat(phase-2.3): indentation tracking with INDENT/DEDENT tokens#2Mjboothaus merged 1 commit intomainfrom
Mjboothaus merged 1 commit intomainfrom
Conversation
…kens Phase 2 lexer complete! Indentation logic is the hardest part of YAML parsing. Implementation: - Track indentation level at start of each line - Emit INDENT token when indentation increases - Emit DEDENT token(s) when indentation decreases - Handle blank lines and comment-only lines (don't change indentation) - Emit remaining DEDENT tokens at EOF - Validate indentation consistency (no misaligned dedents) Features: - Support for multiple nesting levels - Multiple DEDENT tokens when jumping back multiple levels - Proper handling of mixed structures (lists + mappings) - Edge case handling (blank lines, comments, EOF) Testing: - 10 new indentation-specific tests - Updated 2 structural tests to account for INDENT/DEDENT - Total: 74 tests passing (10 basic + 15 scalars + 7 structural + 10 indentation + 17 values + 15 fixtures) Phase 2 Lexer Status: COMPLETE ✅ - Phase 2.1: Scalar tokenisation ✅ - Phase 2.2: Structural tokens ✅ - Phase 2.3: Indentation logic ✅ Next: Phase 3 - Parser implementation Co-Authored-By: Warp <agent@warp.dev>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 2.3: Indentation Tracking - LEXER COMPLETE!
This completes Phase 2 of the YAML Lite implementation. The lexer now has full indentation tracking.
Implementation Details
Core Logic:
indent_stackFeatures:
Testing
10 new indentation tests:
Updated 2 structural tests to account for INDENT/DEDENT tokens
Test Results
Phase 2 Complete! ✅
Next Steps
Phase 3 will implement the parser to build YamlValue structures from the token stream.