libflux

package
v0.101.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2021 License: MIT Imports: 9 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnvStdlib

func EnvStdlib() []byte

EnvStdlib takes care of creating a flux_buffer_t, passes the buffer to the Flatbuffers TypeEnvironment and then takes care of freeing the data

func FindVarType added in v0.74.0

func FindVarType(astPkg *ASTPkg, varName string) (semantic.MonoType, error)

func MergePackages

func MergePackages(outPkg *ASTPkg, inPkg *ASTPkg) error

Merge packages merges the files of a given input package into a given output package. This function borrows the input and output packages, but does not own them. Memory must still be freed by the caller of this function.

Types

type ASTPkg

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

ASTPkg is a parsed AST.

func Parse

func Parse(fname string, src string) *ASTPkg

Parse will take a filename and source string and return a parsed source file.

func ParseJSON

func ParseJSON(bs []byte) (*ASTPkg, error)

ParseJSON will take an AST formatted as JSON and return a handle the Rust AST package.

func ParseString

func ParseString(src string) *ASTPkg

func (ASTPkg) ASTHandle

func (p ASTPkg) ASTHandle()

ASTHandle makes sure that this type implements the flux.ASTHandle interface.

func (*ASTPkg) Free

func (p *ASTPkg) Free()

func (ASTPkg) GetError

func (p ASTPkg) GetError() error

GetError will return the first error in the AST, if any

func (*ASTPkg) MarshalFB

func (p *ASTPkg) MarshalFB() ([]byte, error)

func (*ASTPkg) MarshalJSON

func (p *ASTPkg) MarshalJSON() ([]byte, error)

func (*ASTPkg) String

func (p *ASTPkg) String() string

type Analyzer

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

func NewAnalyzer

func NewAnalyzer() *Analyzer

func (*Analyzer) Analyze

func (p *Analyzer) Analyze(astPkg *ASTPkg) (*SemanticPkg, error)

func (*Analyzer) Free

func (p *Analyzer) Free()

Free frees the memory allocated by Rust for the semantic graph.

type SemanticPkg

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

SemanticPkg is a Rust pointer to a semantic package.

func Analyze

func Analyze(astPkg *ASTPkg) (*SemanticPkg, error)

Analyze parses the given Flux source, performs type inference (taking into account types from prelude and stdlib) and returns an a SemanticPkg containing an opaque pointer to the semantic graph. The graph can be deserialized by calling MarshalFB.

Note that Analyze will consume the AST, so astPkg.ptr will be set to nil, even if there's an error in analysis.

func (*SemanticPkg) Free

func (p *SemanticPkg) Free()

Free frees the memory allocated by Rust for the semantic graph.

func (*SemanticPkg) MarshalFB

func (p *SemanticPkg) MarshalFB() ([]byte, error)

MarshalFB serializes the given semantic package into a flatbuffer.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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