Expand Gotlin language and tooling

This commit is contained in:
pavel 2026-08-27 01:46:57 +02:00
commit de1262b4cf
41 changed files with 6059 additions and 379 deletions

View file

@ -4,9 +4,24 @@ type Program struct {
PackagePath string
Imports []ImportDecl
Interfaces []InterfaceDecl
Enums []EnumDecl
Classes []ClassDecl
Workers []WorkerDecl
Functions []FunctionDecl
Embeds []EmbedDecl
}
type EmbedDecl struct{ Path, Name, Type string }
type EnumDecl struct {
Name string
Variants []EnumVariant
String bool
}
type EnumVariant struct {
Name string
PayloadTypes []string
StringValue string
}
type ImportDecl struct {
@ -20,10 +35,13 @@ type InterfaceDecl struct {
}
type ClassDecl struct {
Name string
Fields []FieldDecl
Parents []string
Methods []FunctionDecl
Name string
Data bool
JSONNaming string
Table string
Fields []FieldDecl
Parents []string
Methods []FunctionDecl
}
type WorkerDecl struct {
@ -40,9 +58,13 @@ type WorkerFieldDecl struct {
}
type FieldDecl struct {
Mutable bool
Name string
Type string
Mutable bool
Private bool
Name string
Type string
Column string
ID bool
Generated bool
}
type FunctionSignature struct {
@ -90,6 +112,7 @@ func (MultiVarDecl) stmtNode() {}
type AssignStmt struct {
Name string
Pos int
Value Expr
}
@ -97,14 +120,16 @@ func (AssignStmt) stmtNode() {}
type AddAssignStmt struct {
Name string
Pos int
Value Expr
}
func (AddAssignStmt) stmtNode() {}
type MultiAssignStmt struct {
Names []string
Value Expr
Names []string
Positions []int
Value Expr
}
func (MultiAssignStmt) stmtNode() {}
@ -127,6 +152,12 @@ type GoStmt struct {
func (GoStmt) stmtNode() {}
type DeferStmt struct {
Value Expr
}
func (DeferStmt) stmtNode() {}
type ExprStmt struct {
Value Expr
}
@ -148,6 +179,14 @@ type WhileStmt struct {
func (WhileStmt) stmtNode() {}
type ForEachStmt struct {
Name string
Source Expr
Body []Stmt
}
func (ForEachStmt) stmtNode() {}
type TryCatchStmt struct {
TryBody []Stmt
CatchName string
@ -163,6 +202,19 @@ type SelectStmt struct {
func (SelectStmt) stmtNode() {}
type MatchStmt struct {
Value Expr
Cases []MatchCase
}
func (MatchStmt) stmtNode() {}
type MatchCase struct {
EnumName, VariantName string
Bindings []string
Body []Stmt
}
type SelectCase struct {
Source Expr
Body []Stmt
@ -180,6 +232,12 @@ type IntExpr struct {
func (IntExpr) exprNode() {}
type FloatExpr struct {
Value string
}
func (FloatExpr) exprNode() {}
type StringExpr struct {
Value string
}
@ -212,9 +270,15 @@ type BinaryExpr struct {
func (BinaryExpr) exprNode() {}
type CallExpr struct {
Callee Expr
Args []Expr
TypeArgs []string
Callee Expr
Args []Expr
TypeArgs []string
NamedArgs []NamedArg
}
type NamedArg struct {
Name string
Value Expr
}
func (CallExpr) exprNode() {}
@ -226,6 +290,20 @@ type SelectorExpr struct {
func (SelectorExpr) exprNode() {}
type IndexExpr struct {
Receiver Expr
Index Expr
}
func (IndexExpr) exprNode() {}
type EnumVariantExpr struct {
EnumName, VariantName string
Values []Expr
}
func (EnumVariantExpr) exprNode() {}
type LambdaExpr struct {
Params []Param
ImplicitIt bool