spl 编写编译器基础框架 ai修复出现的stage2和stage3问题并提供新语法
This commit is contained in:
1 parent
126b979f72
commit
50ee126d44
87 files changed
+3168
-394
No files matched your search
@@ -86,6 +86,7 @@ type Body = enum {
|
||||
},
|
||||
ExprAggregateLit: struct { name: ByteView, fields: Vec },
|
||||
ExprComptimeCall: struct { name: ByteView, args: Vec },
|
||||
ExprShapeApply: struct { adapter: ByteView, shapes: Vec, args: Vec },
|
||||
ExprTry: struct { value: usize }, // `try expr`
|
||||
ExprCatch: struct { value: usize, pattern: usize, handler: usize }, // `expr catch <pat> { }`
|
||||
ExprBlock: struct { stmts: Vec, tail_expr: usize },
|
||||
@@ -129,6 +130,7 @@ type Body = enum {
|
||||
TypeShapeApply: struct { base: ByteView, binds: Vec },
|
||||
TypeAssocBind: struct { name: ByteView, ty: usize },
|
||||
TypeShapeUse: struct { adapter: ByteView, shapes: Vec },
|
||||
TypeShapeNoDefault: struct { shapes: Vec },
|
||||
}
|
||||
|
||||
fn kind_name(body: Body): []u8 {
|
||||
@@ -180,6 +182,7 @@ fn kind_name(body: Body): []u8 {
|
||||
.ExprArrayLit(_) => { ret "array_literal"; },
|
||||
.ExprAggregateLit(_) => { ret "aggregate_literal"; },
|
||||
.ExprComptimeCall(_) => { ret "comptime_call"; },
|
||||
.ExprShapeApply(_) => { ret "shape_apply"; },
|
||||
.ExprTry(_) => { ret "try_expr"; },
|
||||
.ExprCatch(_) => { ret "catch_expr"; },
|
||||
.ExprComptimeInit(_) => { ret "comptime_init"; },
|
||||
@@ -201,6 +204,7 @@ fn kind_name(body: Body): []u8 {
|
||||
.TypeShapeApply(_) => { ret "type_shape_apply"; },
|
||||
.TypeAssocBind(_) => { ret "type_assoc_bind"; },
|
||||
.TypeShapeUse(_) => { ret "type_shape_use"; },
|
||||
.TypeShapeNoDefault(_) => { ret "type_shape_no_default"; },
|
||||
.TypeComptimeCall(_) => { ret "type_comptime_call"; },
|
||||
.PatternIdent(_) => { ret "pattern_ident"; },
|
||||
.PatternUnderscore => { ret "pattern_underscore"; },
|
||||
@@ -530,6 +534,10 @@ fn dump_node(ast: *Ast, buf: *ByteBuffer, stack: *Vec, ref: usize, last: bool):
|
||||
},
|
||||
.ExprAggregateLit(a) => { ok = dump_list(ast, buf, stack, a.fields); },
|
||||
.ExprComptimeCall(c) => { ok = dump_list(ast, buf, stack, c.args); },
|
||||
.ExprShapeApply(x) => {
|
||||
ok = dump_list(ast, buf, stack, x.shapes) &&
|
||||
dump_list(ast, buf, stack, x.args);
|
||||
},
|
||||
.ExprTry(t2) => { ok = dump_opt(ast, buf, stack, t2.value, true); },
|
||||
.ExprCatch(c2) => {
|
||||
ok = dump_opt(ast, buf, stack, c2.value, false) &&
|
||||
@@ -593,6 +601,7 @@ fn dump_node(ast: *Ast, buf: *ByteBuffer, stack: *Vec, ref: usize, last: bool):
|
||||
.TypeShapeApply(a) => { ok = dump_list(ast, buf, stack, a.binds); },
|
||||
.TypeAssocBind(a) => { ok = dump_opt(ast, buf, stack, a.ty, true); },
|
||||
.TypeShapeUse(a) => { ok = dump_list(ast, buf, stack, a.shapes); },
|
||||
.TypeShapeNoDefault(a) => { ok = dump_list(ast, buf, stack, a.shapes); },
|
||||
.TypeComptimeCall(c) => { ok = dump_list(ast, buf, stack, c.args); },
|
||||
.PatternIdent(x) => {},
|
||||
.PatternUnderscore => {},
|
||||
|
||||
Reference in new issue
Block a user