#[non_exhaustive]pub enum SyntaxError {
Show 77 variants
IncompleteEscape,
InvalidEscape,
UnclosedParen {
opening_location: Location,
},
UnclosedSingleQuote {
opening_location: Location,
},
UnclosedDoubleQuote {
opening_location: Location,
},
UnclosedDollarSingleQuote {
opening_location: Location,
},
UnclosedParam {
opening_location: Location,
},
EmptyParam,
InvalidParam,
InvalidModifier,
MultipleModifier,
UnclosedCommandSubstitution {
opening_location: Location,
},
UnclosedBackquote {
opening_location: Location,
},
UnclosedArith {
opening_location: Location,
},
InvalidCommandToken,
MissingSeparator,
FdOutOfRange,
InvalidIoLocation,
MissingRedirOperand,
MissingHereDocDelimiter,
MissingHereDocContent,
UnclosedHereDocContent {
redir_op_location: Location,
},
UnclosedArrayValue {
opening_location: Location,
},
UnopenedGrouping,
UnclosedGrouping {
opening_location: Location,
},
EmptyGrouping,
UnopenedSubshell,
UnclosedSubshell {
opening_location: Location,
},
EmptySubshell,
UnopenedLoop,
UnopenedDoClause,
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,
UnopenedIf,
UnclosedIf {
opening_location: Location,
},
MissingCaseSubject,
InvalidCaseSubject,
MissingIn {
opening_location: Location,
},
UnclosedPatternList,
MissingPattern,
InvalidPattern,
EsacAsPattern,
UnopenedCase,
UnclosedCase {
opening_location: Location,
},
UnmatchedParenthesis,
MissingFunctionBody,
InvalidFunctionBody,
InAsCommandName,
MissingPipeline(AndOr),
DoubleNegation,
BangAfterBar,
MissingCommandAfterBang,
MissingCommandAfterBar,
RedundantToken,
IncompleteControlEscape,
IncompleteControlBackslashEscape,
InvalidControlEscape,
OctalEscapeOutOfRange,
IncompleteHexEscape,
IncompleteShortUnicodeEscape,
IncompleteLongUnicodeEscape,
UnicodeEscapeOutOfRange,
}
Expand description
Types of syntax errors
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
IncompleteEscape
A backslash is at the end of the input.
InvalidEscape
A backslash is not followed by a character that makes a valid escape.
UnclosedParen
A (
lacks a closing )
.
UnclosedSingleQuote
A single quotation lacks a closing '
.
UnclosedDoubleQuote
A double quotation lacks a closing "
.
UnclosedDollarSingleQuote
A $'
lacks a closing '
.
UnclosedParam
A parameter expansion lacks a closing }
.
EmptyParam
A parameter expansion lacks a name.
InvalidParam
A parameter expansion has an invalid name.
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.
UnclosedCommandSubstitution
A command substitution started with $(
but lacks a closing )
.
UnclosedBackquote
A command substitution started with `
but lacks a closing `
.
UnclosedArith
An arithmetic expansion lacks a closing ))
.
InvalidCommandToken
A command begins with an inappropriate keyword or operator token.
MissingSeparator
A separator is missing between commands.
FdOutOfRange
The file descriptor specified for a redirection cannot be used.
InvalidIoLocation
An I/O location prefix attached to a redirection has an unsupported format.
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
A here-document content is missing its delimiter.
UnclosedArrayValue
An array assignment started with =(
but lacks a closing )
.
UnopenedGrouping
A }
appears without a matching {
.
UnclosedGrouping
A grouping is not closed.
EmptyGrouping
A grouping contains no commands.
UnopenedSubshell
A )
appears without a matching (
.
UnclosedSubshell
A subshell is not closed.
EmptySubshell
A subshell contains no commands.
UnopenedLoop
A do
appears outside a loop.
UnopenedDoClause
A done
appears outside a loop.
UnclosedDoClause
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
A for loop is missing a do clause.
UnclosedWhileClause
A while loop is missing a do clause.
EmptyWhileCondition
A while loop’s condition is empty.
UnclosedUntilClause
An until loop is missing a do clause.
EmptyUntilCondition
An until loop’s condition is empty.
IfMissingThen
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
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.
UnopenedIf
An elif
, else
, then
, or fi
appears outside an if command.
UnclosedIf
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
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
.
UnopenedCase
An esac
or ;;
appears outside a case command.
UnclosedCase
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.
InAsCommandName
The keyword in
is used as a command name.
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.
RedundantToken
There is a redundant token.
IncompleteControlEscape
A control escape (\c...
) is incomplete in a dollar-single-quoted string.
IncompleteControlBackslashEscape
A control-backslash escape (\c\\
) is incomplete in a dollar-single-quoted string.
InvalidControlEscape
A control escape (\c...
) does not have a valid control character.
OctalEscapeOutOfRange
An octal escape is out of range (greater than \377
) in a dollar-single-quoted string.
IncompleteHexEscape
An hexadecimal escape (\x...
) is incomplete in a dollar-single-quoted string.
IncompleteShortUnicodeEscape
A Unicode escape (\u...
) is incomplete in a dollar-single-quoted string.
IncompleteLongUnicodeEscape
A Unicode escape (\U...
) is incomplete in a dollar-single-quoted string.
UnicodeEscapeOutOfRange
A Unicode escape (\u...
or \U...
) is out of range in a dollar-single-quoted string.
Implementations§
Trait Implementations§
Source§impl Clone for SyntaxError
impl Clone for SyntaxError
Source§fn clone(&self) -> SyntaxError
fn clone(&self) -> SyntaxError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for SyntaxError
impl Debug for SyntaxError
Source§impl Display for SyntaxError
impl Display for SyntaxError
Source§impl Error for SyntaxError
impl Error for SyntaxError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Source§impl From<SyntaxError> for ErrorCause
impl From<SyntaxError> for ErrorCause
Source§fn from(source: SyntaxError) -> Self
fn from(source: SyntaxError) -> Self
Source§impl PartialEq for SyntaxError
impl PartialEq for SyntaxError
impl Eq for SyntaxError
impl StructuralPartialEq for SyntaxError
Auto Trait Implementations§
impl Freeze for SyntaxError
impl !RefUnwindSafe for SyntaxError
impl !Send for SyntaxError
impl !Sync for SyntaxError
impl Unpin for SyntaxError
impl !UnwindSafe for SyntaxError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more