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 ¶
- type RecordDef
- type SyntaxShape
- func Any() SyntaxShape
- func Binary() SyntaxShape
- func Block() SyntaxShape
- func Boolean() SyntaxShape
- func CellPath() SyntaxShape
- func Closure(args ...SyntaxShape) SyntaxShape
- func DateTime() SyntaxShape
- func Directory() SyntaxShape
- func Duration() SyntaxShape
- func Error() SyntaxShape
- func Expression() SyntaxShape
- func ExternalArgument() SyntaxShape
- func Filepath() SyntaxShape
- func Filesize() SyntaxShape
- func Float() SyntaxShape
- func FullCellPath() SyntaxShape
- func GlobPattern() SyntaxShape
- func ImportPattern() SyntaxShape
- func Int() SyntaxShape
- func Keyword(keyword []byte, shape SyntaxShape) SyntaxShape
- func List(itemType SyntaxShape) SyntaxShape
- func MatchBlock() SyntaxShape
- func MathExpression() SyntaxShape
- func Nothing() SyntaxShape
- func Number() SyntaxShape
- func OneOf(itemType ...SyntaxShape) SyntaxShape
- func Operator() SyntaxShape
- func Range() SyntaxShape
- func Record(fields RecordDef) SyntaxShape
- func RowCondition() SyntaxShape
- func Signature() SyntaxShape
- func String() SyntaxShape
- func Table(fields RecordDef) SyntaxShape
- func VarWithOptType() SyntaxShape
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 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 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`