package
0.22.0-dev
Repository: https://github.com/elves/elvish.git
Documentation: pkg.go.dev

# Packages

Package cmpd contains utilities for working with compound nodes.
Package np provides utilities for working with node paths from a leaf of a parse tree to the root.
Package parseutil contains utilities built on top of the parse package.

# Functions

Children returns all children of the node in the parse tree.
IsInlineWhitespace reports whether r is an inline whitespace character.
IsWhitespace reports whether r is a whitespace.
NewSep makes a new Sep.
Parent returns the parent of a node.
Parse parses the given source.
ParseAs parses the given source as a node, depending on the dynamic type of n.
Quote returns a valid Elvish expression that evaluates to the given string.
QuoteAs returns a representation of s in Elvish syntax, preferring the syntax specified by q, which must be one of Bareword, SingleQuoted, or DoubleQuoted.
QuoteCommandName is like [Quote], but uses the slightly laxer rule for what can appear in a command name unquoted, like <.
QuoteVariableName is like [Quote], but quotes s if it contains any character that may not appear unquoted in variable names.
SourceForTest returns a Source used for testing.
SourceText returns the part of the source text that parses to the node.
UnpackErrors returns the constituent parse errors if the given error contains one or more parse errors.
ValidLHSVariable returns whether a [Primary] node containing a variable name being used as the LHS of an assignment form without the $ prefix is valid.

# Constants

Possible values for RedirMode.
Possible values for PrimaryType.
Possible values for RedirMode.
Possible values for PrimaryType.
Possible values for PrimaryType.
BracedElemExpr represents an expression used as an element in a braced expression.
CmdExpr represents an expression used as the command in a form.
Possible values for PrimaryType.
Possible values for PrimaryType.
Possible values for PrimaryType.
LHSExpr represents an expression used as the left-hand-side in either assignments or map pairs.
Possible values for PrimaryType.
Possible values for PrimaryType.
NormalExpr represents a normal expression, namely none of the special ones below.
Possible values for PrimaryType.
Possible values for RedirMode.
Possible values for RedirMode.
Possible values for PrimaryType.
Possible values for PrimaryType.
Possible values for PrimaryType.
Possible values for PrimaryType.
Possible values for RedirMode.

# Structs

Array = { Space | '\n' } { Compound { Space | '\n' } }.
Chunk = { PipelineSep | Space } { Pipeline { PipelineSep | Space } }.
Compound = { Indexing }.
Config keeps configuration options when parsing.
ErrorTag parameterizes [diag.Error] to define [Error].
Filter is the Elvish filter DSL.
Form = { Compound-CmdExpr } { Space } { ( Compound | MapPair | Redir ) { Space } }.
Indexing = Primary { '[' Array ']' }.
MapPair = '&' { Space } Compound { Space } Compound.
Pipeline = Form { '|' Form }.
Primary is the smallest expression unit.
Redir = { Compound } { '<'|'>'|'<>'|'>>' } { Space } ( '&'? Compound ).
Sep is the catch-all node type for leaf nodes that lack internal structures and semantics, and serve solely for syntactic purposes.
Source describes a piece of source code.
Tree represents a parsed tree.

# Interfaces

Node represents a parse tree as well as an AST.

# Type aliases

ExprCtx represents special contexts of expression parsing.
PrimaryType is the type of a Primary.
RedirMode records the mode of an IO redirection.