precheck

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package precheck finds what would surely fail in a part of an island script before it runs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(code string, env Env, globals Globals) ([]Finding, Globals)

Check checks one part of a script against env and the globals the accepted parts before it left. It returns why the part must be refused, nothing if it may run, and the globals once it is accepted. A part it can't parse passes.

Types

type Env

type Env struct {
	// Widgets are the views and controls under ui, by name.
	Widgets map[string]Widget
	// Layouts are the params schemas of the layouts under ui, by name.
	Layouts map[string]*jsonschema.Schema
	// Apps are the names of the app functions under app.
	Apps map[string]bool
	// Globals are the script's other globals: its tools and the built-ins.
	Globals map[string]bool
}

Env is what an island script reaches besides what its parts declare.

type Finding

type Finding struct {
	Line    int
	Column  int
	Message string
}

Finding is one reason to refuse a part.

func (Finding) Error

func (f Finding) Error() string

Error formats the finding like a syntax error of the part.

type Globals

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

Globals is what the accepted parts of one script left in its global scope. The zero value is the scope before the first part.

type Widget

type Widget struct {
	Params *jsonschema.Schema
	Patch  *jsonschema.Schema
}

Widget is a view or control.

Jump to

Keyboard shortcuts

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