api

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusBadRequest    = 100
	StatusInternalError = 101
)

Variables

This section is empty.

Functions

func SolveAnnotations

func SolveAnnotations(solver func(*AnnotationSolverRequest) (*AnnotationSolverResponse, error))

SolveAnnotations solves annotations and writes the result to stdout and exits.

Types

type Annotation

type Annotation struct {
	ID     ID                   `json:"id"`
	Object ID                   `json:"object"`
	Params map[string]Parameter `json:"params"`
}

Annotation represents an annotation.

type AnnotationSolverRequest

type AnnotationSolverRequest struct {
	Objects     map[ID]*Object     `json:"objects"`
	Annotations map[ID]*Annotation `json:"annotations"`
}

AnnotationSolverRequest represents a request to solve annotations.

type AnnotationSolverResponse

type AnnotationSolverResponse struct {
	Annotations map[ID]*Annotation `json:"annotations"`
}

AnnotationSolverResponse represents a response to solve annotations.

type ID

type ID = int

ID represents an identifier.

type NextEnv

type NextEnv struct {
	NextPath   string   `json:"next_path"`
	ImportDirs []string `json:"import_dirs"`
}

NextEnv represents the environment of the next compiler.

type Object

type Object struct {
	ID   ID         `json:"id"`
	Name string     `json:"name"`
	Type ObjectType `json:"type"`
	Pkg  string     `json:"pkg"`
	File string     `json:"file"`
}

Object represents an object which may be annotated.

type ObjectType

type ObjectType = string
const (
	ObjectFile            ObjectType = "file"
	ObjectConstDecl       ObjectType = "const.decl"
	ObjectConst           ObjectType = "const"
	ObjectEnumDecl        ObjectType = "enum.decl"
	ObjectEnum            ObjectType = "enum"
	ObjectEnumMember      ObjectType = "enum.member"
	ObjectStructDecl      ObjectType = "struct.decl"
	ObjectStruct          ObjectType = "struct"
	ObjectStructField     ObjectType = "struct.field"
	ObjectInterfaceDecl   ObjectType = "interface.decl"
	ObjectInterface       ObjectType = "interface"
	ObjectInterfaceMethod ObjectType = "interface.method"
)

type Parameter

type Parameter struct {
	// Name of the parameter.
	Name string `json:"name"`
	// Type of the value may be: string, int64, uint64, float32, float64, bool, or nil.
	Value any `json:"value"`
}

Parameter represents an annotation parameter.

Jump to

Keyboard shortcuts

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