Files
franalgaba__grimoire/spells/test-nested-conditional.spell
Fran Algaba 001b16258c migrate .spell DSL to brace-delimited syntax (#14)
* migrate .spell DSL from indentation to brace-delimited syntax (SPEC-001)

Replace Python-style 2-space indentation with Rust/Go curly-brace
blocks across the entire codebase. This is a breaking syntax change
that improves agent authorship — LLMs handle braces far better than
whitespace-significant formats.

Tokenizer: remove INDENT/DEDENT tokens, split bracketDepth into
parenDepth (suppresses newlines) and braceDepth (preserves newlines),
remove IndentationError.

Parser: replace all INDENT/DEDENT patterns with LBRACE/RBRACE across
~22 methods. New parseBraceBlock() helper replaces parseStatementBlock().
Two patterns: label blocks (label: { }) and keyword blocks (keyword { }).

AST, transformer, IR generator, and runtime are unchanged — indentation
was purely a lexical/parse concern.

Updated 86 .spell fixture files, 15 test files, 20 documentation files,
README, AGENTS.md, VM spec references, and compiler-pipeline docs.

620 tests pass, 0 fail.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add changeset

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 14:04:08 +01:00

30 lines
712 B
Plaintext

# Test: Nested conditionals — tests deep branching logic
spell TestNestedConditional {
version: "1.0.0"
description: "Nested if/else chains — tests deep conditional branching"
assets: [ETH, USDC]
params: {
amount: 500000
tier: 2
}
on manual: {
if params.tier > 2 {
if params.amount > 1000000 {
emit high_tier_large(tier=params.tier, amount=params.amount)
} else {
emit high_tier_small(tier=params.tier, amount=params.amount)
}
} else {
if params.amount > 1000000 {
emit low_tier_large(tier=params.tier, amount=params.amount)
} else {
emit low_tier_small(tier=params.tier, amount=params.amount)
}
}
}
}