Documentation
¶
Overview ¶
AUTOGENERATED. DO NOT EDIT.
Index ¶
- Constants
- func AssertCodeErrors(t *testing.T, errString, code string) bool
- func AssertCodeEvalsToGrammar(t *testing.T, expected parser.Grammar, code string)
- func AssertCodeEvalsToType(t *testing.T, expected interface{}, code string) bool
- func AssertCodePanics(t *testing.T, code string) bool
- func AssertCodeParseErrors(t *testing.T, errString, code string) bool
- func AssertCodesEvalToSameValue(t *testing.T, expected, code string) bool
- func AssertCodesEvalToSameValueCtx(ctx context.Context, t *testing.T, expected, code string) bool
- func AssertEvalExprString(t *testing.T, expected, source string) bool
- func Compile(ctx context.Context, filePath, source string) (rel.Expr, error)
- func EvalWithScope(ctx context.Context, path, source string, scope rel.Scope) (rel.Value, error)
- func EvaluateBundle(bundle []byte, args ...string) (rel.Value, error)
- func EvaluateBundleCtx(ctx context.Context, bundle []byte, args ...string) (rel.Value, error)
- func EvaluateExpr(ctx context.Context, path, source string) (rel.Value, error)
- func FixFuncs() (rel.Value, rel.Value)
- func GetBuildInfo(b buildinfo.BuildData) rel.Value
- func GetMainBundleSource(ctx context.Context) (context.Context, []byte, string)
- func GetModuleFromBundle(ctx context.Context, buf []byte) (context.Context, string, error)
- func LoadCompiledPlan(ctx context.Context) (*rel.Plan, error)
- func MustAbs(t *testing.T, filePath string) string
- func MustCompile(ctx context.Context, filePath, source string) rel.Expr
- func NewPackageExpr(scanner parser.Scanner, a rel.Expr) rel.Expr
- func OutputArraiz(ctx context.Context, w io.Writer) error
- func PrettifyString(val interface{}, indentsNum int) (string, error)
- func RequireCodesEvalToSameValue(t *testing.T, expected string, code string)
- func SafeStdScope() rel.Scope
- func SafeStdScopeTuple() rel.Tuple
- func SetupBundle(ctx context.Context, filePath string, source []byte) (_ context.Context, err error)
- func StdScope() rel.Scope
- func WithBundleRun(ctx context.Context, buf []byte) (context.Context, error)
- func WriteCompiledPlan(ctx context.Context, expr rel.Expr) error
- type Enumerable
- type EvalConfig
- type ImportExpr
- type Macro
- type MacroValue
- type PackageExpr
- type ParseContext
- func (pc ParseContext) CompileExpr(ctx context.Context, b ast.Branch) (rel.Expr, error)
- func (pc ParseContext) MustParse(ctx context.Context, s *parser.Scanner) ast.Branch
- func (pc ParseContext) MustParseString(ctx context.Context, s string) ast.Branch
- func (pc ParseContext) Parse(ctx context.Context, s *parser.Scanner) (ast.Branch, error)
- type StopError
Constants ¶
const ( // ModuleDir contains all the module files in a bundled scripts. ModuleDir = "/module" // NoModuleDir contains all the module files without root in a bundled scripts. NoModuleDir = "/unnamed" // BundleConfig contains configurations to run a bundled scripts. BundleConfig = "/config.arrai" )
const ModuleRootSentinel = "go.mod"
ModuleRootSentinel is a file which marks the module root of a project.
const NoPath = "\000"
Variables ¶
This section is empty.
Functions ¶
func AssertCodeErrors ¶
AssertCodeErrors asserts that code fails with a certain message when executed.
func AssertCodeEvalsToGrammar ¶ added in v0.73.0
AssertCodeEvalsToGrammar asserts that code evaluates to a grammar equal to expected.
func AssertCodeEvalsToType ¶
AssertCodeEvalsToType asserts that code evaluates to the same type as expected.
func AssertCodePanics ¶
AssertCodePanics asserts that code panics when executed. TODO: Remove this. Should only intentionally panic for implementation bugs.
func AssertCodeParseErrors ¶ added in v0.179.0
AssertCodeParseErrors asserts that code fails with a certain message when parsed.
func AssertCodesEvalToSameValue ¶
AssertCodesEvalToSameValue asserts that code evaluate to the same value as expected.
func AssertCodesEvalToSameValueCtx ¶ added in v0.184.0
AssertCodesEvalToSameValueCtx asserts that code evaluate to the same value as expected under the given context.
func AssertEvalExprString ¶ added in v0.3.0
AssertEvalExprString asserts Expr string.
func EvalWithScope ¶
func EvaluateBundle ¶ added in v0.161.0
EvaluateBundle evaluates the buffer of a bundled scripts using the arrai bundle cmd. If args are provided, they override the values of //os.args.
func EvaluateBundleCtx ¶ added in v0.184.0
EvaluateBundleCtx evaluates the buffer of a bundled scripts using the arrai bundle cmd. If args are provided, they override the values of //os.args.
func EvaluateExpr ¶
EvaluateExpr evaluate the passed in arrai script `source` and returns the evaluated arrai value. Parameter `path` is used as source context, could be empty.
func GetBuildInfo ¶ added in v0.103.0
GetBuildInfo returns arr.ai build information.
func GetMainBundleSource ¶ added in v0.161.0
GetMainBundleSource gets the path for the main arrai script in the bundled arrai scripts.
func GetModuleFromBundle ¶ added in v0.173.0
GetModuleFromBundle fetches the module path of the bundle from the bundle's buffer.
func LoadCompiledPlan ¶ added in v0.340.0
LoadCompiledPlan reads /plan.bin from a running bundle, or nil if absent.
func NewPackageExpr ¶
NewPackageExpr evaluates to !a.
func OutputArraiz ¶ added in v0.161.0
OutputArraiz writes the zip binary to the provided writer.
func PrettifyString ¶ added in v0.102.0
PrettifyString returns a string which represents `rel.Value` with more reabable format. For example, `{b: 2, a: 1, c: (a: 2, b: {aa: {bb: (a: 22, d: {3, 1, 2})}})}` is formatted to:
{
b: 2,
a: 1,
c: (
a: 2,
b: {
aa: {
bb: (
a: 22,
d: {3, 1, 2}
)
}
}
)
}
func RequireCodesEvalToSameValue ¶
RequireCodesEvalToSameValue requires that code evaluates to the same value as expected.
func SafeStdScope ¶ added in v0.274.0
func SafeStdScopeTuple ¶ added in v0.274.0
func SetupBundle ¶ added in v0.161.0
func SetupBundle(ctx context.Context, filePath string, source []byte) (_ context.Context, err error)
SetupBundle adds necessary values to the context for bundling arrai scripts.
func WithBundleRun ¶ added in v0.161.0
WithBundleRun adds necessary values to the context to allow running bundled arrai scripts.
Types ¶
type Enumerable ¶ added in v0.117.0
type Enumerable interface {
ArrayEnumerator() rel.ValueEnumerator
}
type EvalConfig ¶ added in v0.274.0
type EvalConfig struct {
// contains filtered or unexported fields
}
type ImportExpr ¶ added in v0.146.0
type ImportExpr struct {
rel.ExprScanner
// contains filtered or unexported fields
}
func NewImportExpr ¶ added in v0.146.0
func (ImportExpr) String ¶ added in v0.146.0
func (i ImportExpr) String() string
type Macro ¶ added in v0.73.0
type Macro struct {
// contains filtered or unexported fields
}
Macro represents the metadata of a macro invocation: the grammar and rule to parse with, and the transform to apply to the parsed body.
type MacroValue ¶ added in v0.73.0
MacroValue is an Extra node with an Expr value and a Scanner for the macro source.
func NewMacroValue ¶ added in v0.73.0
func NewMacroValue(expr rel.Expr, scanner parser.Scanner) MacroValue
NewMacroValue returns a MacroValue with a given Expr and Scanner.
func (MacroValue) Scanner ¶ added in v0.73.0
func (m MacroValue) Scanner() parser.Scanner
Scanner returns a scanner of the source that was replaced by the macro.
func (MacroValue) SubExpr ¶ added in v0.73.0
func (m MacroValue) SubExpr() rel.Expr
SubExpr returns the Expr resulting from evaluating the macro.
type PackageExpr ¶
type PackageExpr struct {
rel.ExprScanner
// contains filtered or unexported fields
}
PackageExpr represents a range of operators.
func (PackageExpr) String ¶
func (e PackageExpr) String() string
String returns a string representation of the expression.
type ParseContext ¶
type ParseContext struct {
SourceDir string
}
func (ParseContext) CompileExpr ¶
func (ParseContext) MustParseString ¶
MustParseString parses input string and returns the parsed Expr or panics.
Source Files
¶
- bindata.go
- bundle.go
- compile.go
- compile_xstr.go
- config.go
- constants.go
- eval.go
- expr_import.go
- expr_package.go
- gomod.go
- import.go
- logging.go
- parse.go
- parse_macro.go
- parse_string.go
- parser.go
- plan.go
- prettify.go
- std.go
- std_archive.go
- std_bits.go
- std_deprecated.go
- std_encoding.go
- std_encoding_csv.go
- std_encoding_json.go
- std_encoding_xlsx.go
- std_encoding_xml.go
- std_encoding_yaml.go
- std_eval.go
- std_fmt.go
- std_net.go
- std_os.go
- std_os_nonwasm.go
- std_re.go
- std_reflect.go
- std_rel.go
- std_runtime.go
- std_seq.go
- std_seq_array_helper.go
- std_seq_bytes_helper.go
- std_str.go
- std_tst.go
- test_helpers.go
- util.go