syntaxshape

package
v0.0.0-...-1d43779 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2025 License: MIT Imports: 2 Imported by: 3

Documentation

Overview

Package syntaxshape defines type and functions to describe Nu syntax shapes.

It is used by the github.com/ainvaltin/nu-plugin to define Plugin signature.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RecordDef

type RecordDef map[string]SyntaxShape

RecordDef is the "field list" of the Record and Table Syntax Shapes. The key is field name and value is the type of the field.

type SyntaxShape

type SyntaxShape interface {
	EncodeMsgpack(enc *msgpack.Encoder) error
	// contains filtered or unexported methods
}

The syntactic shapes that describe how a sequence should be parsed.

Use functions in this package to construct concrete syntax shape.

https://docs.rs/nu-protocol/latest/nu_protocol/enum.SyntaxShape.html

func Any

func Any() SyntaxShape

Any syntactic form is allowed.

func Binary

func Binary() SyntaxShape

A binary literal.

func Block

func Block() SyntaxShape

func Boolean

func Boolean() SyntaxShape

func CellPath

func CellPath() SyntaxShape

func Closure

func Closure(args ...SyntaxShape) SyntaxShape

func DateTime

func DateTime() SyntaxShape

func Directory

func Directory() SyntaxShape

func Duration

func Duration() SyntaxShape

func Error

func Error() SyntaxShape

func Expression

func Expression() SyntaxShape

func ExternalArgument

func ExternalArgument() SyntaxShape

func Filepath

func Filepath() SyntaxShape

func Filesize

func Filesize() SyntaxShape

func Float

func Float() SyntaxShape

func FullCellPath

func FullCellPath() SyntaxShape

func GlobPattern

func GlobPattern() SyntaxShape

func ImportPattern

func ImportPattern() SyntaxShape

func Int

func Int() SyntaxShape

func Keyword

func Keyword(keyword []byte, shape SyntaxShape) SyntaxShape

func List

func List(itemType SyntaxShape) SyntaxShape

func MatchBlock

func MatchBlock() SyntaxShape

func MathExpression

func MathExpression() SyntaxShape

func Nothing

func Nothing() SyntaxShape

func Number

func Number() SyntaxShape

Only a numeric (integer or float) value is allowed

func OneOf

func OneOf(itemType ...SyntaxShape) SyntaxShape

func Operator

func Operator() SyntaxShape

func Range

func Range() SyntaxShape

func Record

func Record(fields RecordDef) SyntaxShape

Record describes record type, ie

Shape: syntaxshape.Record(syntaxshape.RecordDef{"a": syntaxshape.Int(), "b": syntaxshape.String()})

Not providing record definition (ie passing nil) means that all record types are accepted.

func RowCondition

func RowCondition() SyntaxShape

func Signature

func Signature() SyntaxShape

func String

func String() SyntaxShape

func Table

func Table(fields RecordDef) SyntaxShape

func VarWithOptType

func VarWithOptType() SyntaxShape

A variable with optional type, `x` or `x: int`

Jump to

Keyboard shortcuts

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