feat: implement for-loops with proper scope management

- Add support for C-style for loops: for (init; condition; increment) { body }
- Implement three-level scoping: loop context + per-iteration contexts
- Add semicolon disabler for increment statements using RAII guards
- Support break/continue/return control flow with scope validation
- Fix semicolon handling in parser for flexible for-loop syntax
This commit is contained in:
2025-12-21 22:55:46 +08:00
parent acc2d33dbc
commit 014803b705
13 changed files with 327 additions and 59 deletions

View File

@@ -35,6 +35,8 @@ namespace Fig
Implement, // implement
Public, // public
Return, // return
Break, // break
Continue, // continue
// TypeNull, // Null
// TypeInt, // Int
@@ -130,7 +132,7 @@ namespace Fig
column = _column;
return *this;
}
FString getValue()
const FString& getValue() const
{
return value;
}
@@ -151,7 +153,7 @@ namespace Fig
return type == TokenType::LiteralNull || type == TokenType::LiteralBool || type == TokenType::LiteralNumber || type == TokenType::LiteralString;
}
TokenType getType()
TokenType getType() const
{
return type;
}