#[non_exhaustive]
pub enum SyntaxError {
Show 55 variants UnclosedParen { opening_location: Location, }, InvalidModifier, MultipleModifier, UnclosedSingleQuote { opening_location: Location, }, UnclosedDoubleQuote { opening_location: Location, }, UnclosedParam { opening_location: Location, }, EmptyParam, UnclosedCommandSubstitution { opening_location: Location, }, UnclosedBackquote { opening_location: Location, }, UnclosedArith { opening_location: Location, }, InvalidCommandToken, FdOutOfRange, MissingRedirOperand, MissingHereDocDelimiter, MissingHereDocContent, UnclosedHereDocContent { redir_op_location: Location, }, UnclosedArrayValue { opening_location: Location, }, UnclosedGrouping { opening_location: Location, }, EmptyGrouping, UnclosedSubshell { opening_location: Location, }, EmptySubshell, UnclosedDoClause { opening_location: Location, }, EmptyDoClause, MissingForName, InvalidForName, InvalidForValue, MissingForBody { opening_location: Location, }, UnclosedWhileClause { opening_location: Location, }, EmptyWhileCondition, UnclosedUntilClause { opening_location: Location, }, EmptyUntilCondition, IfMissingThen { if_location: Location, }, EmptyIfCondition, EmptyIfBody, ElifMissingThen { elif_location: Location, }, EmptyElifCondition, EmptyElifBody, EmptyElse, UnclosedIf { opening_location: Location, }, MissingCaseSubject, InvalidCaseSubject, MissingIn { opening_location: Location, }, UnclosedPatternList, MissingPattern, InvalidPattern, EsacAsPattern, UnclosedCase { opening_location: Location, }, UnmatchedParenthesis, MissingFunctionBody, InvalidFunctionBody, MissingPipeline(AndOr), DoubleNegation, BangAfterBar, MissingCommandAfterBang, MissingCommandAfterBar,
}
Expand description

Types of syntax errors.

Variants (Non-exhaustive)

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.

UnclosedParen

Fields

opening_location: Location

A ( lacks a closing ).

InvalidModifier

A modifier does not have a valid form in a parameter expansion.

MultipleModifier

A braced parameter expansion has both a prefix and suffix modifier.

UnclosedSingleQuote

Fields

opening_location: Location

A single quotation lacks a closing '.

UnclosedDoubleQuote

Fields

opening_location: Location

A double quotation lacks a closing ".

UnclosedParam

Fields

opening_location: Location

A parameter expansion lacks a closing }.

EmptyParam

A parameter expansion lacks a name.

UnclosedCommandSubstitution

Fields

opening_location: Location

A command substitution started with $( but lacks a closing ).

UnclosedBackquote

Fields

opening_location: Location

A command substitution started with ` but lacks a closing `.

UnclosedArith

Fields

opening_location: Location

An arithmetic expansion lacks a closing )).

InvalidCommandToken

A command begins with an inappropriate keyword or operator token.

FdOutOfRange

The file descriptor specified for a redirection cannot be used.

MissingRedirOperand

A redirection operator is missing its operand.

MissingHereDocDelimiter

A here-document operator is missing its delimiter token.

MissingHereDocContent

A here-document operator is missing its corresponding content.

UnclosedHereDocContent

Fields

redir_op_location: Location

A here-document content is missing its delimiter.

UnclosedArrayValue

Fields

opening_location: Location

An array assignment started with =( but lacks a closing ).

UnclosedGrouping

Fields

opening_location: Location

A grouping is not closed.

EmptyGrouping

A grouping contains no commands.

UnclosedSubshell

Fields

opening_location: Location

A subshell is not closed.

EmptySubshell

A subshell contains no commands.

UnclosedDoClause

Fields

opening_location: Location

A do clause is not closed.

EmptyDoClause

A do clause contains no commands.

MissingForName

The variable name is missing in a for loop.

InvalidForName

The variable name is not a valid word in a for loop.

InvalidForValue

A value is not a valid word in a for loop.

MissingForBody

Fields

opening_location: Location

A for loop is missing a do clause.

UnclosedWhileClause

Fields

opening_location: Location

A while loop is missing a do clause.

EmptyWhileCondition

A while loop’s condition is empty.

UnclosedUntilClause

Fields

opening_location: Location

An until loop is missing a do clause.

EmptyUntilCondition

An until loop’s condition is empty.

IfMissingThen

Fields

if_location: Location

An if command is missing the then clause.

EmptyIfCondition

An if command’s condition is empty.

EmptyIfBody

An if command’s body is empty.

ElifMissingThen

Fields

elif_location: Location

An elif clause is missing the then clause.

EmptyElifCondition

An elif clause’s condition is empty.

EmptyElifBody

An elif clause’s body is empty.

EmptyElse

An else clause is empty.

UnclosedIf

Fields

opening_location: Location

An if command is not closed.

MissingCaseSubject

The case command is missing its subject.

InvalidCaseSubject

The subject of the case command is not a valid word.

MissingIn

Fields

opening_location: Location

The case command is missing in after the subject.

UnclosedPatternList

The ) is missing in a case item.

MissingPattern

The pattern is missing in a case item.

InvalidPattern

The pattern is not a valid word token.

EsacAsPattern

The first pattern of a case item is esac.

UnclosedCase

Fields

opening_location: Location

A case command is not closed.

UnmatchedParenthesis

The ( is not followed by ) in a function definition.

MissingFunctionBody

The function body is missing in a function definition command.

InvalidFunctionBody

A function body is not a compound command.

MissingPipeline(AndOr)

A pipeline is missing after a && or || token.

DoubleNegation

Two successive ! tokens.

BangAfterBar

A | token is followed by a !.

MissingCommandAfterBang

A command is missing after a ! token.

MissingCommandAfterBar

A command is missing after a | token.

Implementations

Returns an error message describing the error.

Returns a label for annotating the error location.

Returns a location related with the error cause and a message describing the location.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
Converts to this type from the input type.
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.