wdl

package
v0.0.0-...-258869f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 27, 2024 License: BSD-2-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MacroRegex = regexp.MustCompile(`#\[.+\]`)

Functions

func AnnotationForType

func AnnotationForType[T Annotation](pg *Program, def TypeDef) T

func SplitFirstRune

func SplitFirstRune(s string) (rune, string)

Types

type AggregateRootAnnotation

type AggregateRootAnnotation struct {
	// contains filtered or unexported fields
}

func NewAggregateRootAnnotation

func NewAggregateRootAnnotation(alias string, pos Pos, def TypeDef) *AggregateRootAnnotation

func (*AggregateRootAnnotation) Alias

func (s *AggregateRootAnnotation) Alias() string

func (*AggregateRootAnnotation) Name

func (s *AggregateRootAnnotation) Name() string

func (*AggregateRootAnnotation) Pos

func (s *AggregateRootAnnotation) Pos() Pos

func (*AggregateRootAnnotation) SetAlias

func (s *AggregateRootAnnotation) SetAlias(alias string)

func (*AggregateRootAnnotation) SetPos

func (s *AggregateRootAnnotation) SetPos(pos Pos)

func (*AggregateRootAnnotation) SetTypeDef

func (s *AggregateRootAnnotation) SetTypeDef(typeDef TypeDef)

func (*AggregateRootAnnotation) TypeDef

func (s *AggregateRootAnnotation) TypeDef() TypeDef

type Annotation

type Annotation interface {
	// contains filtered or unexported methods
}

type AssignStmt

type AssignStmt struct {
	// contains filtered or unexported fields
}

func NewAssignStmt

func NewAssignStmt(with func(assignStmt *AssignStmt)) *AssignStmt

func (*AssignStmt) AddLhs

func (a *AssignStmt) AddLhs(lhs ...Expr)

func (*AssignStmt) AddRhs

func (a *AssignStmt) AddRhs(rhs ...Expr)

func (*AssignStmt) Lhs

func (a *AssignStmt) Lhs() []Expr

func (*AssignStmt) Rhs

func (a *AssignStmt) Rhs() []Expr

func (*AssignStmt) SetLhs

func (a *AssignStmt) SetLhs(lhs []Expr)

func (*AssignStmt) SetRhs

func (a *AssignStmt) SetRhs(rhs []Expr)

type BaseType

type BaseType struct {
	// contains filtered or unexported fields
}

func NewBaseType

func NewBaseType(with func(bt *BaseType)) *BaseType

func (*BaseType) AsResolvedType

func (b *BaseType) AsResolvedType() *ResolvedType

func (*BaseType) Clone

func (b *BaseType) Clone() TypeDef

func (*BaseType) Comment

func (b *BaseType) Comment() *Comment

func (*BaseType) Kind

func (b *BaseType) Kind() Kind

func (*BaseType) Name

func (b *BaseType) Name() Identifier

func (*BaseType) Pkg

func (b *BaseType) Pkg() *Package

func (*BaseType) SetKind

func (b *BaseType) SetKind(base Kind)

func (*BaseType) SetName

func (b *BaseType) SetName(name Identifier)

func (*BaseType) SetPkg

func (b *BaseType) SetPkg(pkg *Package)

func (*BaseType) SetTypeParams

func (b *BaseType) SetTypeParams(typeParams []*ResolvedType)

type BinaryExpr

type BinaryExpr struct {
	// contains filtered or unexported fields
}

func NewBinaryExpr

func NewBinaryExpr(with func(bnExpr *BinaryExpr)) *BinaryExpr

func (*BinaryExpr) Left

func (b *BinaryExpr) Left() Expr

func (*BinaryExpr) Operator

func (b *BinaryExpr) Operator() BinaryExprOp

func (*BinaryExpr) Right

func (b *BinaryExpr) Right() Expr

func (*BinaryExpr) SetLeft

func (b *BinaryExpr) SetLeft(left Expr)

func (*BinaryExpr) SetOperator

func (b *BinaryExpr) SetOperator(operator BinaryExprOp)

func (*BinaryExpr) SetRight

func (b *BinaryExpr) SetRight(right Expr)

type BinaryExprOp

type BinaryExprOp int
const (
	NEQ BinaryExprOp = iota + 1
	EQL
)

type BlockStmt

type BlockStmt struct {
	// contains filtered or unexported fields
}

func NewBlockStmt

func NewBlockStmt(with func(block *BlockStmt)) *BlockStmt

func (*BlockStmt) Add

func (b *BlockStmt) Add(list ...Statement)

func (*BlockStmt) List

func (b *BlockStmt) List() []Statement

func (*BlockStmt) SetList

func (b *BlockStmt) SetList(list []Statement)

type BoundedContextAnnotation

type BoundedContextAnnotation struct {
	// contains filtered or unexported fields
}

func NewBoundedContextAnnotation

func NewBoundedContextAnnotation(alias string, pkg *Package, pos Pos) *BoundedContextAnnotation

func (*BoundedContextAnnotation) Alias

func (s *BoundedContextAnnotation) Alias() string

func (*BoundedContextAnnotation) Name

func (s *BoundedContextAnnotation) Name() string

func (*BoundedContextAnnotation) Pkg

func (*BoundedContextAnnotation) Pos

func (s *BoundedContextAnnotation) Pos() Pos

func (*BoundedContextAnnotation) SetAlias

func (s *BoundedContextAnnotation) SetAlias(alias string)

func (*BoundedContextAnnotation) SetPkg

func (s *BoundedContextAnnotation) SetPkg(pkg *Package)

func (*BoundedContextAnnotation) SetPos

func (s *BoundedContextAnnotation) SetPos(pos Pos)

type CallExpr

type CallExpr struct {
	// contains filtered or unexported fields
}

func NewCallExpr

func NewCallExpr(with func(call *CallExpr)) *CallExpr

func (*CallExpr) AddArgs

func (c *CallExpr) AddArgs(args ...Expr)

func (*CallExpr) Args

func (c *CallExpr) Args() []Expr

func (*CallExpr) Fun

func (c *CallExpr) Fun() Expr

func (*CallExpr) SetArgs

func (c *CallExpr) SetArgs(args []Expr)

func (*CallExpr) SetFun

func (c *CallExpr) SetFun(fun Expr)

type Comment

type Comment struct {
	// contains filtered or unexported fields
}

func NewComment

func NewComment(with func(comment *Comment)) *Comment

func NewSimpleComment

func NewSimpleComment(text string) *Comment

func (*Comment) AddLines

func (c *Comment) AddLines(lines ...*CommentLine)

func (*Comment) AddMacros

func (c *Comment) AddMacros(macros ...*MacroInvocation)

func (*Comment) Lines

func (c *Comment) Lines() []*CommentLine

func (*Comment) Macros

func (c *Comment) Macros() []*MacroInvocation

func (*Comment) SetLines

func (c *Comment) SetLines(lines []*CommentLine)

func (*Comment) SetMacros

func (c *Comment) SetMacros(macros []*MacroInvocation)

func (*Comment) String

func (c *Comment) String() string

type CommentLine

type CommentLine struct {
	// contains filtered or unexported fields
}

func NewCommentLine

func NewCommentLine(with func(line *CommentLine)) *CommentLine

func (*CommentLine) Pos

func (c *CommentLine) Pos() Pos

func (*CommentLine) SetPos

func (c *CommentLine) SetPos(pos Pos)

func (*CommentLine) SetText

func (c *CommentLine) SetText(text string)

func (*CommentLine) Text

func (c *CommentLine) Text() string

type DistinctType

type DistinctType struct {
	// contains filtered or unexported fields
}

func NewDistinctType

func NewDistinctType(with func(dType *DistinctType)) *DistinctType

func (*DistinctType) AsResolvedType

func (d *DistinctType) AsResolvedType() *ResolvedType

func (*DistinctType) Clone

func (d *DistinctType) Clone() TypeDef

func (*DistinctType) Comment

func (d *DistinctType) Comment() *Comment

func (*DistinctType) Methods

func (d *DistinctType) Methods() []*Func

func (*DistinctType) Name

func (d *DistinctType) Name() Identifier

func (*DistinctType) Pkg

func (d *DistinctType) Pkg() *Package

func (*DistinctType) SetComment

func (d *DistinctType) SetComment(comment *Comment)

func (*DistinctType) SetMethods

func (d *DistinctType) SetMethods(methods []*Func)

func (*DistinctType) SetName

func (d *DistinctType) SetName(name Identifier)

func (*DistinctType) SetPkg

func (d *DistinctType) SetPkg(pkg *Package)

func (*DistinctType) SetTypeParams

func (d *DistinctType) SetTypeParams(typeParams []*ResolvedType)

func (*DistinctType) SetTypes

func (d *DistinctType) SetTypes(types []*ResolvedType)

func (*DistinctType) SetUnderlying

func (d *DistinctType) SetUnderlying(underlying TypeDef)

func (*DistinctType) SetVisibility

func (d *DistinctType) SetVisibility(visibility Visibility)

func (*DistinctType) TypeParams

func (d *DistinctType) TypeParams() []*ResolvedType

func (*DistinctType) Types

func (d *DistinctType) Types() []*ResolvedType

func (*DistinctType) Underlying

func (d *DistinctType) Underlying() TypeDef

func (*DistinctType) Visibility

func (d *DistinctType) Visibility() Visibility

type DomainEventAnnotation

type DomainEventAnnotation struct {
	// contains filtered or unexported fields
}

func NewDomainEventAnnotation

func NewDomainEventAnnotation(alias string, pos Pos, def TypeDef) *DomainEventAnnotation

func (*DomainEventAnnotation) Alias

func (s *DomainEventAnnotation) Alias() string

func (*DomainEventAnnotation) Name

func (s *DomainEventAnnotation) Name() string

func (*DomainEventAnnotation) Pos

func (s *DomainEventAnnotation) Pos() Pos

func (*DomainEventAnnotation) SetAlias

func (s *DomainEventAnnotation) SetAlias(alias string)

func (*DomainEventAnnotation) SetPos

func (s *DomainEventAnnotation) SetPos(pos Pos)

func (*DomainEventAnnotation) SetTypeDef

func (s *DomainEventAnnotation) SetTypeDef(typeDef TypeDef)

func (*DomainEventAnnotation) TypeDef

func (s *DomainEventAnnotation) TypeDef() TypeDef

type DomainServiceAnnotation

type DomainServiceAnnotation struct {
	// contains filtered or unexported fields
}

func NewDomainServiceAnnotation

func NewDomainServiceAnnotation(alias string, pos Pos, def TypeDef) *DomainServiceAnnotation

func (*DomainServiceAnnotation) Alias

func (s *DomainServiceAnnotation) Alias() string

func (*DomainServiceAnnotation) Name

func (s *DomainServiceAnnotation) Name() string

func (*DomainServiceAnnotation) Pos

func (s *DomainServiceAnnotation) Pos() Pos

func (*DomainServiceAnnotation) SetAlias

func (s *DomainServiceAnnotation) SetAlias(alias string)

func (*DomainServiceAnnotation) SetPos

func (s *DomainServiceAnnotation) SetPos(pos Pos)

func (*DomainServiceAnnotation) SetTypeDef

func (s *DomainServiceAnnotation) SetTypeDef(typeDef TypeDef)

func (*DomainServiceAnnotation) TypeDef

func (s *DomainServiceAnnotation) TypeDef() TypeDef

type EntityAnnotation

type EntityAnnotation struct {
	// contains filtered or unexported fields
}

func NewEntityAnnotation

func NewEntityAnnotation(alias string, pos Pos, def TypeDef) *EntityAnnotation

func (*EntityAnnotation) Alias

func (s *EntityAnnotation) Alias() string

func (*EntityAnnotation) Name

func (s *EntityAnnotation) Name() string

func (*EntityAnnotation) Pos

func (s *EntityAnnotation) Pos() Pos

func (*EntityAnnotation) SetAlias

func (s *EntityAnnotation) SetAlias(alias string)

func (*EntityAnnotation) SetPos

func (s *EntityAnnotation) SetPos(pos Pos)

func (*EntityAnnotation) SetTypeDef

func (s *EntityAnnotation) SetTypeDef(typeDef TypeDef)

func (*EntityAnnotation) TypeDef

func (s *EntityAnnotation) TypeDef() TypeDef

type ErrorWithPos

type ErrorWithPos struct {
	Pos   Pos
	Cause error
}

func NewErrorWithPos

func NewErrorWithPos(pos Pos, cause error) *ErrorWithPos

func (ErrorWithPos) Error

func (e ErrorWithPos) Error() string

func (ErrorWithPos) Unwrap

func (e ErrorWithPos) Unwrap() error

type Expr

type Expr interface {
	// contains filtered or unexported methods
}

type Field

type Field struct {
	// contains filtered or unexported fields
}

func NewField

func NewField(with func(field *Field)) *Field

func (*Field) Comment

func (f *Field) Comment() *Comment

func (*Field) Name

func (f *Field) Name() Identifier

func (*Field) PutTag

func (f *Field) PutTag(key, value string)

func (*Field) SetComment

func (f *Field) SetComment(comment *Comment)

func (*Field) SetName

func (f *Field) SetName(name Identifier)

func (*Field) SetTags

func (f *Field) SetTags(tags map[string]string)

func (*Field) SetTypeDef

func (f *Field) SetTypeDef(typeDef *ResolvedType)

func (*Field) SetVisibility

func (f *Field) SetVisibility(visibility Visibility)

func (*Field) Tags

func (f *Field) Tags() map[string]string

func (*Field) TypeDef

func (f *Field) TypeDef() *ResolvedType

func (*Field) Visibility

func (f *Field) Visibility() Visibility

type File

type File struct {
	// contains filtered or unexported fields
}

File represents a physical source code file respective compilation unit.

  • Go: <lowercase AnnotationName>.go
  • Java: <CamelCasePrimaryTypeName>.java

func NewFile

func NewFile(with func(file *File)) *File

func (*File) AbsolutePath

func (f *File) AbsolutePath() string

func (*File) AddImport

func (f *File) AddImport(identifier Identifier, qualifier PkgImportQualifier)

func (*File) AddTypeDefs

func (f *File) AddTypeDefs(typeDefs ...TypeDef)

func (*File) Comment

func (f *File) Comment() *Comment

func (*File) Generated

func (f *File) Generated() bool

func (*File) Import

func (f *File) Import(src *File)

func (*File) Imports

func (f *File) Imports() map[Identifier]PkgImportQualifier

func (*File) MimeType

func (f *File) MimeType() MimeType

func (*File) Modified

func (f *File) Modified() bool

func (*File) Name

func (f *File) Name() string

func (*File) Path

func (f *File) Path() string

func (*File) Pkg

func (f *File) Pkg() *Package

func (*File) Preamble

func (f *File) Preamble() *Comment

func (*File) RawBytes

func (f *File) RawBytes() []byte

func (*File) SetComment

func (f *File) SetComment(comment *Comment)

func (*File) SetGenerated

func (f *File) SetGenerated(generated bool)

func (*File) SetMimeType

func (f *File) SetMimeType(mimeType MimeType)

func (*File) SetModified

func (f *File) SetModified(modified bool)

func (*File) SetName

func (f *File) SetName(name string)

func (*File) SetPath

func (f *File) SetPath(path string)

func (*File) SetPkg

func (f *File) SetPkg(pkg *Package)

func (*File) SetPreamble

func (f *File) SetPreamble(preamble *Comment)

func (*File) SetRawBytes

func (f *File) SetRawBytes(rawBytes []byte)

func (*File) SetTypeDefs

func (f *File) SetTypeDefs(typeDefs []TypeDef)

func (*File) TypeDefs

func (f *File) TypeDefs() []TypeDef

type Func

type Func struct {
	// contains filtered or unexported fields
}

func NewFunc

func NewFunc(with func(fn *Func)) *Func

func (*Func) AddArgs

func (f *Func) AddArgs(args ...*Param)

func (*Func) AddResults

func (f *Func) AddResults(results ...*Param)

func (*Func) AddTypeParams

func (f *Func) AddTypeParams(typeParams ...*ResolvedType)

func (*Func) Args

func (f *Func) Args() []*Param

func (*Func) AsResolvedType

func (f *Func) AsResolvedType() *ResolvedType

func (*Func) Body

func (f *Func) Body() *BlockStmt

func (*Func) Clone

func (f *Func) Clone() TypeDef

func (*Func) Comment

func (f *Func) Comment() *Comment

func (*Func) Name

func (f *Func) Name() Identifier

func (*Func) Pkg

func (f *Func) Pkg() *Package

func (*Func) Receiver

func (f *Func) Receiver() *Param

func (*Func) Results

func (f *Func) Results() []*Param

func (*Func) SetArgs

func (f *Func) SetArgs(args []*Param)

func (*Func) SetBody

func (f *Func) SetBody(body *BlockStmt)

func (*Func) SetComment

func (f *Func) SetComment(comment *Comment)

func (*Func) SetName

func (f *Func) SetName(name Identifier)

func (*Func) SetPkg

func (f *Func) SetPkg(pkg *Package)

func (*Func) SetReceiver

func (f *Func) SetReceiver(receiver *Param)

func (*Func) SetResults

func (f *Func) SetResults(results []*Param)

func (*Func) SetTypeParams

func (f *Func) SetTypeParams(typeParams []*ResolvedType)

func (*Func) SetVisibility

func (f *Func) SetVisibility(visibility Visibility)

func (*Func) TypeParams

func (f *Func) TypeParams() []*ResolvedType

func (*Func) Visibility

func (f *Func) Visibility() Visibility

type Identifier

type Identifier string

Identifier follows the typical identifier rules of Go or Java. Examples:

  • Go: string, PkgName, Error, String, int64
  • Java: List, String, Integer, int, toString

func (Identifier) String

func (id Identifier) String() string

type IfStmt

type IfStmt struct {
	// contains filtered or unexported fields
}

func NewIfStmt

func NewIfStmt(with func(ifStmt *IfStmt)) *IfStmt

func (*IfStmt) Body

func (i *IfStmt) Body() *BlockStmt

func (*IfStmt) Cond

func (i *IfStmt) Cond() Expr

func (*IfStmt) Else

func (i *IfStmt) Else() Statement

func (*IfStmt) Init

func (i *IfStmt) Init() Statement

func (*IfStmt) SetBody

func (i *IfStmt) SetBody(body *BlockStmt)

func (*IfStmt) SetCond

func (i *IfStmt) SetCond(cond Expr)

func (*IfStmt) SetElse

func (i *IfStmt) SetElse(elseS Statement)

func (*IfStmt) SetInit

func (i *IfStmt) SetInit(initS Statement)

type Interface

type Interface struct {
	// contains filtered or unexported fields
}

func NewInterface

func NewInterface(with func(iface *Interface)) *Interface

func (*Interface) AddTypes

func (u *Interface) AddTypes(types ...*ResolvedType)

func (*Interface) AsResolvedType

func (u *Interface) AsResolvedType() *ResolvedType

func (*Interface) Clone

func (u *Interface) Clone() TypeDef

func (*Interface) Comment

func (u *Interface) Comment() *Comment

func (*Interface) Name

func (u *Interface) Name() Identifier

func (*Interface) Pkg

func (u *Interface) Pkg() *Package

func (*Interface) SetComment

func (u *Interface) SetComment(comment *Comment)

func (*Interface) SetName

func (u *Interface) SetName(name Identifier)

func (*Interface) SetPkg

func (u *Interface) SetPkg(pkg *Package)

func (*Interface) SetTypeParams

func (u *Interface) SetTypeParams(typeParams []*ResolvedType)

func (*Interface) SetTypes

func (u *Interface) SetTypes(types []*ResolvedType)

func (*Interface) Types

func (u *Interface) Types() []*ResolvedType

type Kind

type Kind int
const (
	TString Kind = iota + 1
	TUInt
	TInt
	TInt32
	TInt64
	TUInt32
	TUInt64
	TFloat32
	TFloat64
	TByte
	TAny
	TBool
)

type MacroInvocation

type MacroInvocation struct {
	// contains filtered or unexported fields
}

MacroInvocation is parsed from texts in the following formats (see also MacroRegex]):

  • #[<identifier>.<identifier> <json object body>?]
  • for example #[go.TaggedUnion]
  • for example #[go.TaggedUnion "tag":"$_type"]

func ParseMacroInvocation

func ParseMacroInvocation(text string, pos Pos) (*MacroInvocation, error)

func (*MacroInvocation) DebugParsedParams

func (m *MacroInvocation) DebugParsedParams() map[string]any

func (*MacroInvocation) JsonParams

func (m *MacroInvocation) JsonParams() string

func (*MacroInvocation) Name

func (m *MacroInvocation) Name() MacroName

func (*MacroInvocation) Pos

func (m *MacroInvocation) Pos() Pos

func (*MacroInvocation) UnmarshalParams

func (m *MacroInvocation) UnmarshalParams(dst any) error

func (*MacroInvocation) Value

func (m *MacroInvocation) Value() string

Value returns some duck typing string from the json which looks like a value.

type MacroName

type MacroName string

A MacroName is something like go.TaggedUnion

type MimeType

type MimeType string
const (
	MimeTypeGo         MimeType = "text/x-go-source"
	MimeTypeTypeScript MimeType = "text/x-typescript-source"
	Raw                MimeType = "binary"
)

type MutPtr

type MutPtr struct {
	// contains filtered or unexported fields
}

func NewMutPtr

func NewMutPtr(with func(ptr *MutPtr)) *MutPtr

func (*MutPtr) AsResolvedType

func (m *MutPtr) AsResolvedType() *ResolvedType

func (*MutPtr) Comment

func (m *MutPtr) Comment() []*CommentLine

func (*MutPtr) Macros

func (m *MutPtr) Macros() []*MacroInvocation

func (*MutPtr) Name

func (m *MutPtr) Name() Identifier

func (*MutPtr) Pkg

func (m *MutPtr) Pkg() *Package

func (*MutPtr) SetComment

func (m *MutPtr) SetComment(comment []*CommentLine)

func (*MutPtr) SetMacros

func (m *MutPtr) SetMacros(macros []*MacroInvocation)

func (*MutPtr) SetPkg

func (m *MutPtr) SetPkg(pkg *Package)

func (*MutPtr) SetTypeDef

func (m *MutPtr) SetTypeDef(typeDef TypeDef)

func (*MutPtr) TypeDef

func (m *MutPtr) TypeDef() TypeDef

type Package

type Package struct {
	// contains filtered or unexported fields
}

func NewPackage

func NewPackage(with func(pkg *Package)) *Package

func (*Package) AddFiles

func (p *Package) AddFiles(files ...*File)

func (*Package) AddTypeDefs

func (p *Package) AddTypeDefs(typeDefs ...TypeDef)

func (*Package) AsResolvedType

func (p *Package) AsResolvedType() *ResolvedType

func (*Package) Clone

func (p *Package) Clone() TypeDef

func (*Package) Comment

func (p *Package) Comment() *Comment

func (*Package) Files

func (p *Package) Files() []*File

func (*Package) Macros

func (p *Package) Macros() []*MacroInvocation

func (*Package) Name

func (p *Package) Name() Identifier

func (*Package) Pkg

func (p *Package) Pkg() *Package

func (*Package) Qualifier

func (p *Package) Qualifier() PkgImportQualifier

func (*Package) SetComment

func (p *Package) SetComment(comment *Comment)

func (*Package) SetFiles

func (p *Package) SetFiles(files []*File)

func (*Package) SetName

func (p *Package) SetName(name Identifier)

func (*Package) SetQualifier

func (p *Package) SetQualifier(qualifier PkgImportQualifier)

func (*Package) SetTypeComments

func (p *Package) SetTypeComments(typeComments map[Identifier]*Comment)

func (*Package) SetTypeDefs

func (p *Package) SetTypeDefs(typeDefs []TypeDef)

func (*Package) SetTypeParams

func (p *Package) SetTypeParams(typeParams []*ResolvedType)

func (*Package) TypeComments

func (p *Package) TypeComments() map[Identifier]*Comment

func (*Package) TypeDefs

func (p *Package) TypeDefs() []TypeDef

type Param

type Param struct {
	// contains filtered or unexported fields
}

func NewParam

func NewParam(with func(param *Param)) *Param

func (*Param) Name

func (p *Param) Name() Identifier

func (*Param) SetName

func (p *Param) SetName(name Identifier)

func (*Param) SetTypeDef

func (p *Param) SetTypeDef(typeDef *ResolvedType)

func (*Param) TypeDef

func (p *Param) TypeDef() *ResolvedType

type PermissionAnnotation

type PermissionAnnotation struct {
	// contains filtered or unexported fields
}

func NewPermissionAnnotation

func NewPermissionAnnotation(with func(annotation *PermissionAnnotation)) *PermissionAnnotation

func (*PermissionAnnotation) PermissionID

func (p *PermissionAnnotation) PermissionID() string

func (*PermissionAnnotation) Pos

func (p *PermissionAnnotation) Pos() Pos

func (*PermissionAnnotation) SetPermissionID

func (p *PermissionAnnotation) SetPermissionID(permissionID string)

func (*PermissionAnnotation) SetPos

func (p *PermissionAnnotation) SetPos(pos Pos)

func (*PermissionAnnotation) SetTypeDef

func (p *PermissionAnnotation) SetTypeDef(typeDef TypeDef)

func (*PermissionAnnotation) TypeDef

func (p *PermissionAnnotation) TypeDef() TypeDef

type PkgImportQualifier

type PkgImportQualifier string

A PkgImportQualifier denotes the unique and distinct qualifier for a package. Examples:

  • Go: encoding/json (a path)
  • Java: java.util
  • TypeScript: @/shared/protocol/gen/event (a path)
  • Rust: std::io

type PkgName

type PkgName Identifier

A PkgName is the identifier of a package. Examples:

  • Go: http, ast2, math (this has nothing to do with last segment of the import path)
  • Java: util, collections (always the last segment)
  • TypeScript: there is no package system. Identifiers are imported directly from file imports (just the relative path without file extension).
  • Rust: std, io (looks like there are multiple ways to define them, some conventional by path, some explicit)

type Pos

type Pos struct {
	File string
	Line int
}

func NewPos

func NewPos(file string, line int) Pos

func (Pos) String

func (p Pos) String() string

type Program

type Program struct {
	// contains filtered or unexported fields
}

func NewProgram

func NewProgram(with func(program *Program)) *Program

func (*Program) AddAnnotations

func (p *Program) AddAnnotations(annotations ...Annotation)

func (*Program) AddPackage

func (p *Program) AddPackage(pkg *Package)

func (*Program) Annotations

func (p *Program) Annotations() []Annotation

func (*Program) MustResolveSimple

func (p *Program) MustResolveSimple(path, ident string) *ResolvedType

func (*Program) PackageByPath

func (p *Program) PackageByPath(q PkgImportQualifier) (*Package, bool)

func (*Program) Packages

func (p *Program) Packages() []*Package

func (*Program) Path

func (p *Program) Path() string

func (*Program) SetAnnotations

func (p *Program) SetAnnotations(annotations []Annotation)

func (*Program) SetPath

func (p *Program) SetPath(path string)

func (*Program) TypeDef

func (p *Program) TypeDef(ref *TypeRef) (TypeDef, bool)

type ProjectAnnotation

type ProjectAnnotation struct {
	// contains filtered or unexported fields
}

func NewProjectAnnotation

func NewProjectAnnotation(alias string, pkg *Package, pos Pos) *ProjectAnnotation

func (*ProjectAnnotation) Alias

func (s *ProjectAnnotation) Alias() string

func (*ProjectAnnotation) Name

func (s *ProjectAnnotation) Name() string

func (*ProjectAnnotation) Pkg

func (s *ProjectAnnotation) Pkg() *Package

func (*ProjectAnnotation) Pos

func (s *ProjectAnnotation) Pos() Pos

func (*ProjectAnnotation) SetAlias

func (s *ProjectAnnotation) SetAlias(alias string)

func (*ProjectAnnotation) SetPkg

func (s *ProjectAnnotation) SetPkg(pkg *Package)

func (*ProjectAnnotation) SetPos

func (s *ProjectAnnotation) SetPos(pos Pos)

type RawStmt

type RawStmt string

type RepositoryAnnotation

type RepositoryAnnotation struct {
	// contains filtered or unexported fields
}

func NewRepositoryAnnotation

func NewRepositoryAnnotation(alias string, pos Pos, def TypeDef) *RepositoryAnnotation

func (*RepositoryAnnotation) Alias

func (s *RepositoryAnnotation) Alias() string

func (*RepositoryAnnotation) Name

func (s *RepositoryAnnotation) Name() string

func (*RepositoryAnnotation) SetAlias

func (s *RepositoryAnnotation) SetAlias(alias string)

func (*RepositoryAnnotation) SetTypeDef

func (s *RepositoryAnnotation) SetTypeDef(typeDef TypeDef)

func (*RepositoryAnnotation) TypeDef

func (s *RepositoryAnnotation) TypeDef() TypeDef

type ResolvedType

type ResolvedType struct {
	// contains filtered or unexported fields
}

ResolvedType tries to simplify things.

func NewResolvedType

func NewResolvedType(with func(rType *ResolvedType)) *ResolvedType

func (*ResolvedType) AddParams

func (r *ResolvedType) AddParams(params ...*ResolvedType)

func (*ResolvedType) AsTypeRef

func (r *ResolvedType) AsTypeRef() *TypeRef

func (*ResolvedType) Name

func (r *ResolvedType) Name() Identifier

func (*ResolvedType) Params

func (r *ResolvedType) Params() []*ResolvedType

func (*ResolvedType) Pkg

func (r *ResolvedType) Pkg() *Package

func (*ResolvedType) Pointer

func (r *ResolvedType) Pointer() bool

func (*ResolvedType) SetName

func (r *ResolvedType) SetName(name Identifier)

func (*ResolvedType) SetParams

func (r *ResolvedType) SetParams(params []*ResolvedType)

func (*ResolvedType) SetPkg

func (r *ResolvedType) SetPkg(pkg *Package)

func (*ResolvedType) SetPointer

func (r *ResolvedType) SetPointer(pointer bool)

func (*ResolvedType) SetTypeDef

func (r *ResolvedType) SetTypeDef(typeDef TypeDef)

func (*ResolvedType) SetTypeParam

func (r *ResolvedType) SetTypeParam(typeParam bool)

func (*ResolvedType) TypeDef

func (r *ResolvedType) TypeDef() TypeDef

func (*ResolvedType) TypeParam

func (r *ResolvedType) TypeParam() bool

type ReturnStmt

type ReturnStmt struct {
	// contains filtered or unexported fields
}

func NewReturnStmt

func NewReturnStmt(with func(*ReturnStmt)) *ReturnStmt

func (*ReturnStmt) AddResults

func (r *ReturnStmt) AddResults(results ...Expr)

func (*ReturnStmt) Results

func (r *ReturnStmt) Results() []Expr

func (*ReturnStmt) SetResults

func (r *ReturnStmt) SetResults(results []Expr)

type SelectorExpr

type SelectorExpr struct {
	// contains filtered or unexported fields
}

func NewSelectorExpr

func NewSelectorExpr(with func(sel *SelectorExpr)) *SelectorExpr

func (*SelectorExpr) Sel

func (s *SelectorExpr) Sel() Identifier

func (*SelectorExpr) SetSel

func (s *SelectorExpr) SetSel(sel Identifier)

func (*SelectorExpr) SetX

func (s *SelectorExpr) SetX(x Expr)

func (*SelectorExpr) X

func (s *SelectorExpr) X() Expr

type Statement

type Statement interface {
	// contains filtered or unexported methods
}

type StrLit

type StrLit struct {
	// contains filtered or unexported fields
}

func NewStrLit

func NewStrLit(with func(lit *StrLit)) *StrLit

func (*StrLit) SetValue

func (c *StrLit) SetValue(value string)

func (*StrLit) Value

func (c *StrLit) Value() string

type Struct

type Struct struct {
	// contains filtered or unexported fields
}

func NewStruct

func NewStruct(with func(strct *Struct)) *Struct

func (*Struct) AddFields

func (s *Struct) AddFields(fields ...*Field)

func (*Struct) AddMethods

func (s *Struct) AddMethods(methods ...*Func)

func (*Struct) AddTypeParams

func (s *Struct) AddTypeParams(typeParams ...*ResolvedType)

func (*Struct) AsResolvedType

func (s *Struct) AsResolvedType() *ResolvedType

func (*Struct) Clone

func (s *Struct) Clone() TypeDef

func (*Struct) Comment

func (s *Struct) Comment() *Comment

func (*Struct) Fields

func (s *Struct) Fields() []*Field

func (*Struct) Methods

func (s *Struct) Methods() []*Func

func (*Struct) Name

func (s *Struct) Name() Identifier

func (*Struct) Pkg

func (s *Struct) Pkg() *Package

func (*Struct) SetComment

func (s *Struct) SetComment(comment *Comment)

func (*Struct) SetFields

func (s *Struct) SetFields(fields []*Field)

func (*Struct) SetMethods

func (s *Struct) SetMethods(methods []*Func)

func (*Struct) SetName

func (s *Struct) SetName(name Identifier)

func (*Struct) SetPkg

func (s *Struct) SetPkg(pkg *Package)

func (*Struct) SetTypeParams

func (s *Struct) SetTypeParams(typeParams []*ResolvedType)

func (*Struct) SetTypes

func (s *Struct) SetTypes(types []*ResolvedType)

func (*Struct) SetVisibility

func (s *Struct) SetVisibility(visibility Visibility)

func (*Struct) TypeParams

func (s *Struct) TypeParams() []*ResolvedType

func (*Struct) Types

func (s *Struct) Types() []*ResolvedType

func (*Struct) Visibility

func (s *Struct) Visibility() Visibility

type TypeDef

type TypeDef interface {
	Name() Identifier
	AsResolvedType() *ResolvedType
	Comment() *Comment
	Clone() TypeDef
	SetTypeParams(typeParams []*ResolvedType)
	Pkg() *Package
	// contains filtered or unexported methods
}

A TypeDef is a marker interface and contains all types which define the memory layout of a type. Note, that this is the c semantic and not the Go Spec semantic, which uses the term declaration for functions and other GenDecl like alias, interface et al. They use the term type definition when introducing a new defined type based on another type (e.g. type Text string)

type TypeParam

type TypeParam struct {
	// contains filtered or unexported fields
}

func NewTypeParam

func NewTypeParam(with func(tParm *TypeParam)) *TypeParam

func (*TypeParam) AsResolvedType

func (t *TypeParam) AsResolvedType() *ResolvedType

func (*TypeParam) Clone

func (t *TypeParam) Clone() TypeDef

func (*TypeParam) Comment

func (t *TypeParam) Comment() *Comment

func (*TypeParam) Name

func (t *TypeParam) Name() Identifier

func (*TypeParam) Pkg

func (t *TypeParam) Pkg() *Package

func (*TypeParam) SetName

func (t *TypeParam) SetName(name Identifier)

func (*TypeParam) SetPkg

func (t *TypeParam) SetPkg(pkg *Package)

func (*TypeParam) SetTypeParams

func (t *TypeParam) SetTypeParams(typeParams []*ResolvedType)

type TypeRef

type TypeRef struct {
	Qualifier PkgImportQualifier
	Name      Identifier
	Pointer   bool
	Params    []*TypeRef
	TypeParam bool // TODO how to model bound (go) and upper and lower bounds (java)

}

func (TypeRef) String

func (t TypeRef) String() string

type Union

type Union struct {
	// contains filtered or unexported fields
}

func NewUnion

func NewUnion(with func(union *Union)) *Union

func (*Union) AddTypes

func (u *Union) AddTypes(types ...*ResolvedType)

func (*Union) AsResolvedType

func (u *Union) AsResolvedType() *ResolvedType

func (*Union) Clone

func (u *Union) Clone() TypeDef

func (*Union) Comment

func (u *Union) Comment() *Comment

func (*Union) File

func (u *Union) File() *File

func (*Union) Name

func (u *Union) Name() Identifier

func (*Union) Pkg

func (u *Union) Pkg() *Package

func (*Union) SetComment

func (u *Union) SetComment(comment *Comment)

func (*Union) SetFile

func (u *Union) SetFile(file *File)

func (*Union) SetName

func (u *Union) SetName(name Identifier)

func (*Union) SetPkg

func (u *Union) SetPkg(pkg *Package)

func (*Union) SetTypeParams

func (u *Union) SetTypeParams(typeParams []*ResolvedType)

func (*Union) SetTypes

func (u *Union) SetTypes(types []*ResolvedType)

func (*Union) SetVisibility

func (u *Union) SetVisibility(visibility Visibility)

func (*Union) Types

func (u *Union) Types() []*ResolvedType

func (*Union) Visibility

func (u *Union) Visibility() Visibility

type UseCaseAnnotation

type UseCaseAnnotation struct {
	// contains filtered or unexported fields
}

func NewUseCaseAnnotation

func NewUseCaseAnnotation(alias string, fn *Func, pos Pos) *UseCaseAnnotation

func (*UseCaseAnnotation) Alias

func (s *UseCaseAnnotation) Alias() string

func (*UseCaseAnnotation) Fn

func (s *UseCaseAnnotation) Fn() *Func

func (*UseCaseAnnotation) Name

func (s *UseCaseAnnotation) Name() string

func (*UseCaseAnnotation) Pos

func (s *UseCaseAnnotation) Pos() Pos

func (*UseCaseAnnotation) SetAlias

func (s *UseCaseAnnotation) SetAlias(alias string)

func (*UseCaseAnnotation) SetFn

func (s *UseCaseAnnotation) SetFn(fn *Func)

func (*UseCaseAnnotation) SetPos

func (s *UseCaseAnnotation) SetPos(pos Pos)

func (*UseCaseAnnotation) TypeDef

func (s *UseCaseAnnotation) TypeDef() TypeDef

type ValueAnnotation

type ValueAnnotation struct {
	// contains filtered or unexported fields
}

func NewValueAnnotation

func NewValueAnnotation(alias string, pos Pos, def TypeDef) *ValueAnnotation

func (*ValueAnnotation) Alias

func (s *ValueAnnotation) Alias() string

func (*ValueAnnotation) Name

func (s *ValueAnnotation) Name() string

func (*ValueAnnotation) Pos

func (s *ValueAnnotation) Pos() Pos

func (*ValueAnnotation) SetAlias

func (s *ValueAnnotation) SetAlias(alias string)

func (*ValueAnnotation) SetPos

func (s *ValueAnnotation) SetPos(pos Pos)

func (*ValueAnnotation) SetTypeDef

func (s *ValueAnnotation) SetTypeDef(typeDef TypeDef)

func (*ValueAnnotation) TypeDef

func (s *ValueAnnotation) TypeDef() TypeDef

type Visibility

type Visibility int
const (
	PackagePrivat Visibility = iota
	Public
)

Directories

Path Synopsis
parser

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL