Generated: 2026-01-14
Status: Reader-only, ~80% common YAML coverage
✅ WORKS: Simple configs, nested structures, basic types, comments
❌ NOT SUPPORTED: Flow-style [...], empty values, anchors/aliases
- Status: ✅ WORKS after quoting multi-word strings and version numbers
- Patterns used: Nested mappings, sequences, inline list-mappings, all scalar types
- Size: 740 bytes
- Status: ✅ WORKS with flow-style arrays converted to block style
- Patterns used: Nested list-mappings (repos → hooks), inline continuation
- Note: Original has
['markdown']which needs conversion to block style
- Status: ✅ WORKS perfectly as designed
- Patterns used: All supported features without workarounds
- Purpose: Reference implementation for v0.1.0
- Issue: Empty value handling (e.g.,
db-data:at end) - Status: Needs explicit
nullor value
- Issue:
exclude_types: ['markdown']fails at line 3 - Reason: Flow-style arrays not supported
- Workaround: Rewrite as block style:
exclude_types: - markdown
- Issue:
os: [ubuntu-latest, macos-latest]fails at line 14 - Reason: Flow-style arrays not supported
- Workaround: Rewrite as block style:
os: - ubuntu-latest - macos-latest
| Feature | Support | Notes |
|---|---|---|
| Basic Mappings | ✅ Full | key: value |
| Nested Mappings | ✅ Full | Any depth |
| Sequences | ✅ Full | - item block style only |
| Nested Sequences | ✅ Full | Any depth, block style |
| Inline List-Mapping | ✅ Full | - name: value with continuation |
| Comments | ✅ Full | # comment anywhere |
| Integers | ✅ Full | 42, -17 |
| Floats | ✅ Full | 3.14, 1.5e10 (single decimal point) |
| Booleans | ✅ Full | true, false, yes, no |
| Null | ✅ Full | null, ~ |
| Quoted Strings | ✅ Full | "text", 'text' |
| Unquoted Strings | Must quote multi-word strings | |
| Version Numbers | version: "0.1.0" not version: 0.1.0 |
|
| Empty Values | ❌ Not supported | key: causes errors |
| Flow-Style Arrays | ❌ Not supported | [1, 2, 3] fails |
| Flow-Style Mappings | ❌ Not supported | {key: value} fails |
| Anchors | ❌ Not supported | &anchor not recognized |
| Aliases | ❌ Not supported | *reference not recognized |
| Multi-Document | ❌ Not supported | --- separator ignored |
| Literal Blocks | ❌ Not supported | ` |
| Folded Blocks | ❌ Not supported | > not recognized |
| Tags | ❌ Not supported | !tag not recognized |
| Directives | ❌ Not supported | %TAG, %YAML ignored |
Problem:
version: 0.1.0 # ❌ FAILS - parsed as 0.1 then .0 is invalidSolution:
version: "0.1.0" # ✅ WORKS - quote version numbersProblem:
platforms: [linux, macos, windows] # ❌ FAILSSolution:
platforms: # ✅ WORKS - use block style
- linux
- macos
- windowsProblem:
database: # ❌ FAILS - empty value
host: # ❌ FAILS - empty valueSolution:
database: null # ✅ WORKS - explicit null
host: "" # ✅ WORKS - empty stringProblem:
description: YAML parser for Mojo # ❌ FAILS - spaces in unquoted string
message: Hello world # ❌ FAILSSolution:
description: "YAML parser for Mojo" # ✅ WORKS
message: "Hello world" # ✅ WORKSNote: Single-word unquoted strings work fine:
name: localhost # ✅ WORKS
path: /usr/bin # ✅ WORKSProblem:
message: Hello, world! # ❌ FAILS - comma
url: http://example.com?foo=bar # ⚠️ MAY FAIL - special charsSolution:
message: "Hello, world!" # ✅ WORKS
url: "http://example.com?foo=bar&baz=qux" # ✅ WORKS
---
## What Actually Works
This parser excels at:
1. **Configuration Files** - Simple block-style configs with nested structures
2. **Data Exports** - Lists of records with consistent structure
3. **Simple Documents** - Basic key-value stores with comments
### Working Example
```yaml
# Application configuration
app:
name: "my-app"
version: "1.0.0" # Must quote version numbers!
debug: true
timeout: 30.5
database:
host: localhost
port: 5432
credentials:
user: admin
password_file: /secrets/db_pass
servers:
- name: web1
ip: 192.168.1.10
roles:
- web
- api
- name: web2
ip: 192.168.1.11
roles:
- web
- api
features:
- authentication
- caching
- logging
- Number Parsing: Version numbers like
1.2.3treated as1.2+ invalid.3 - Empty Values:
key:with no value causes parse errors - Flow Style: No support for
[...]or{...}syntax
- String Detection: Unquoted strings with special characters may fail
- Multi-Decimal Numbers: Only one decimal point allowed in floats
- Anchors/Aliases:
&anchorand*reference- requires reference tracking - Multi-Document:
---separators - would need document array return - Literal/Folded:
|and>- complex multiline string handling - Complex Keys:
? complex\n: value- rarely used in practice
When testing if your YAML file is compatible:
- Quote multi-word strings: Change
description: YAML parsertodescription: "YAML parser" - Quote version numbers: Change
version: 1.0.0toversion: "1.0.0" - Use block style: Convert
[a, b]to list format - Make values explicit: Change
key:tokey: nullorkey: "" - Quote special characters: If string contains
:[]{}#|>, quote it
Planned enhancements based on real-world needs:
- Support version number patterns (multiple dots)
- Handle empty values gracefully
- Flow-style array support
[1, 2, 3] - Better error messages with fix suggestions
Not planned:
- ❌ Anchors/aliases (complex, rarely needed)
- ❌ Multi-document (niche use case)
- ❌ Literal/folded blocks (marginal utility)
Best for: Simple, block-style YAML configs and data files
Works great with: Quoted strings, explicit values, nested structures
Avoid: Flow style, empty values, unquoted multi-word strings, anchors
Remember: When in doubt, quote your strings!