Enum yash_syntax::parser::SyntaxError
source · #[non_exhaustive]pub enum SyntaxError {
Show 63 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,
MissingSeparator,
FdOutOfRange,
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,
}
Expand description
Types of syntax errors.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
UnclosedParen
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
A single quotation lacks a closing '
.
UnclosedDoubleQuote
A double quotation lacks a closing "
.
UnclosedParam
A parameter expansion lacks a closing }
.
EmptyParam
A parameter expansion lacks a name.
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.
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.
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
source§fn eq(&self, other: &SyntaxError) -> bool
fn eq(&self, other: &SyntaxError) -> bool
self
and other
values to be equal, and is used
by ==
.