Add map literals

Map literals share the brackets with lists, but they use colons to
delimit keys and values.

Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
2024-10-15 19:01:21 -07:00
parent 07a59c8930
commit 2ec122016c
6 changed files with 115 additions and 5 deletions

View File

@@ -229,7 +229,10 @@ GENERATE = [
"rbrace: Token",
],
)
.add_struct("List", ["lbracket: Token", "exprs: Vec<ExprP>", "rbracket: Token"]),
.add_struct("List", ["lbracket: Token", "exprs: Vec<ExprP>", "rbracket: Token"])
.add_struct(
"Map", ["lbracket: Token", "pairs: Vec<(ExprP, ExprP)>", "rbracket: Token"]
),
# Stmt
GenerateGroup("Stmt")
.add_struct("Import", ["import_kw: Token", "what: Vec<Token>", "module: Token"])