-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
mappingMapping languageMapping languagetestingTesting infrastructureTesting infrastructurev0.2.0Milestone: v0.2.0 Mapping LanguageMilestone: v0.2.0 Mapping Language
Description
Description
Parse token stream into an AST representing mapping operations.
AST Nodes (v0.2.0 subset)
enum Statement {
Rename { from: Path, to: Path },
Select { paths: Vec<Path> },
Drop { paths: Vec<Path> },
Set { path: Path, expr: Expr },
Default { path: Path, expr: Expr },
Cast { path: Path, target_type: Type },
}
enum Expr {
Literal(Value),
Path(Path),
FunctionCall { name: String, args: Vec<Expr> },
BinaryOp { left: Box<Expr>, op: Op, right: Box<Expr> },
UnaryOp { op: Op, expr: Box<Expr> },
}TDD Tests
- rename:
rename .a -> .b→ Rename node - select:
select .a, .b, .c→ Select with 3 paths - drop:
drop .x→ Drop with 1 path - set with literal:
set .x = 42→ Set with Literal expr - set with path:
set .x = .y→ Set with Path expr - set with function:
set .x = lower(.y)→ Set with FunctionCall - set with binary op:
set .x = .a + .b→ Set with BinaryOp - default:
default .x = "hello"→ Default node - cast:
cast .x as int→ Cast node for each type - multi-statement: multiple lines parse as Vec
- comments ignored: parser skips comment tokens
- Error: missing arrow in rename: clear error
- Error: missing
=in set: clear error - Error: unknown keyword: clear error with suggestion
Part of #2
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
mappingMapping languageMapping languagetestingTesting infrastructureTesting infrastructurev0.2.0Milestone: v0.2.0 Mapping LanguageMilestone: v0.2.0 Mapping Language