Enum ezno_parser::statements::Statement
source · pub enum Statement {
Show 26 variants
Expression(MultipleExpression),
Block(Block),
Debugger(Span),
VariableDeclaration(VariableStatement),
FunctionDeclaration(Decorated<StatementFunction>),
ExtractedFunction(ExtractedFunction<StatementFunctionBase>),
ClassDeclaration(Decorated<ClassDeclaration<StatementPosition>>),
EnumDeclaration(Decorated<EnumDeclaration>),
InterfaceDeclaration(Decorated<InterfaceDeclaration>),
TypeAlias(TypeAlias),
DeclareVariableDeclaration(DeclareVariableDeclaration),
DeclareFunctionDeclaration(DeclareFunctionDeclaration),
DeclareInterfaceDeclaration(InterfaceDeclaration),
IfStatement(IfStatement),
ForLoopStatement(ForLoopStatement),
SwitchStatement(SwitchStatement),
WhileStatement(WhileStatement),
DoWhileStatement(DoWhileStatement),
ReturnStatement(Keyword<Return>, Option<MultipleExpression>),
Continue(Span),
Break(Span),
Comment(String, Span),
MultiLineComment(String, Span),
ImportStatement(ImportStatement),
ExportStatement(Decorated<ExportStatement>),
Cursor(CursorId<Statement>, Span),
}
Expand description
A statement
TODO Import and Export are only allowed in top level modules. Could there be a TopLevelStatement
which
extends Statement and includes them, therefore retaining type safety
Throw is on Expression (non-standard)
Variants§
Expression(MultipleExpression)
Block(Block)
{ … } statement
Debugger(Span)
VariableDeclaration(VariableStatement)
FunctionDeclaration(Decorated<StatementFunction>)
ExtractedFunction(ExtractedFunction<StatementFunctionBase>)
ClassDeclaration(Decorated<ClassDeclaration<StatementPosition>>)
EnumDeclaration(Decorated<EnumDeclaration>)
InterfaceDeclaration(Decorated<InterfaceDeclaration>)
TypeAlias(TypeAlias)
DeclareVariableDeclaration(DeclareVariableDeclaration)
DeclareFunctionDeclaration(DeclareFunctionDeclaration)
DeclareInterfaceDeclaration(InterfaceDeclaration)
IfStatement(IfStatement)
ForLoopStatement(ForLoopStatement)
SwitchStatement(SwitchStatement)
WhileStatement(WhileStatement)
DoWhileStatement(DoWhileStatement)
ReturnStatement(Keyword<Return>, Option<MultipleExpression>)
Continue(Span)
Break(Span)
Comment(String, Span)
MultiLineComment(String, Span)
ImportStatement(ImportStatement)
ExportStatement(Decorated<ExportStatement>)
Cursor(CursorId<Statement>, Span)
TODO under cfg
Implementations§
source§impl Statement
impl Statement
sourcepub fn is_ts_statement(&self) -> bool
pub fn is_ts_statement(&self) -> bool
Used for skipping in to_string
sourcepub fn is_comment(&self) -> bool
pub fn is_comment(&self) -> bool
Used for skipping in to_string
Trait Implementations§
source§impl ASTNode for Statement
impl ASTNode for Statement
source§fn get_position(&self) -> Cow<'_, Span>
fn get_position(&self) -> Cow<'_, Span>
Returns position of node as span AS IT WAS PARSED. May be none if AST was doesn’t match anything in source
fn from_reader( reader: &mut impl TokenReader<TSXToken, Span>, state: &mut ParsingState, settings: &ParseSettings ) -> ParseResult<Self>
fn to_string_from_buffer<T: ToString>( &self, buf: &mut T, settings: &ToStringSettingsAndData, depth: u8 )
source§fn from_string(
source: String,
settings: ParseSettings,
source_id: SourceId,
offset: Option<usize>,
cursors: Vec<(usize, EmptyCursorId)>
) -> ParseResult<ParseOutput<Self>>
fn from_string( source: String, settings: ParseSettings, source_id: SourceId, offset: Option<usize>, cursors: Vec<(usize, EmptyCursorId)> ) -> ParseResult<ParseOutput<Self>>
From string, with default impl to call abstract method from_reader
source§fn to_string(&self, settings: &ToStringSettingsAndData) -> String
fn to_string(&self, settings: &ToStringSettingsAndData) -> String
Returns structure as valid string
source§impl From<DeclareFunctionDeclaration> for Statement
impl From<DeclareFunctionDeclaration> for Statement
source§fn from(item: DeclareFunctionDeclaration) -> Statement
fn from(item: DeclareFunctionDeclaration) -> Statement
Converts to this type from the input type.
source§impl From<DeclareVariableDeclaration> for Statement
impl From<DeclareVariableDeclaration> for Statement
source§fn from(item: DeclareVariableDeclaration) -> Statement
fn from(item: DeclareVariableDeclaration) -> Statement
Converts to this type from the input type.
source§impl From<Decorated<ClassDeclaration<StatementPosition>>> for Statement
impl From<Decorated<ClassDeclaration<StatementPosition>>> for Statement
source§fn from(item: Decorated<ClassDeclaration<StatementPosition>>) -> Statement
fn from(item: Decorated<ClassDeclaration<StatementPosition>>) -> Statement
Converts to this type from the input type.
source§impl From<DoWhileStatement> for Statement
impl From<DoWhileStatement> for Statement
source§fn from(item: DoWhileStatement) -> Statement
fn from(item: DoWhileStatement) -> Statement
Converts to this type from the input type.
source§impl From<ExtractedFunction<GeneralFunctionBase<StatementPosition>>> for Statement
impl From<ExtractedFunction<GeneralFunctionBase<StatementPosition>>> for Statement
source§fn from(item: ExtractedFunction<StatementFunctionBase>) -> Statement
fn from(item: ExtractedFunction<StatementFunctionBase>) -> Statement
Converts to this type from the input type.
source§impl From<ForLoopStatement> for Statement
impl From<ForLoopStatement> for Statement
source§fn from(item: ForLoopStatement) -> Statement
fn from(item: ForLoopStatement) -> Statement
Converts to this type from the input type.
source§impl From<IfStatement> for Statement
impl From<IfStatement> for Statement
source§fn from(item: IfStatement) -> Statement
fn from(item: IfStatement) -> Statement
Converts to this type from the input type.
source§impl From<ImportStatement> for Statement
impl From<ImportStatement> for Statement
source§fn from(item: ImportStatement) -> Statement
fn from(item: ImportStatement) -> Statement
Converts to this type from the input type.
source§impl From<MultipleExpression> for Statement
impl From<MultipleExpression> for Statement
source§fn from(item: MultipleExpression) -> Statement
fn from(item: MultipleExpression) -> Statement
Converts to this type from the input type.
source§impl From<Statement> for BlockOrSingleStatement
impl From<Statement> for BlockOrSingleStatement
source§impl From<SwitchStatement> for Statement
impl From<SwitchStatement> for Statement
source§fn from(item: SwitchStatement) -> Statement
fn from(item: SwitchStatement) -> Statement
Converts to this type from the input type.
source§impl From<VariableStatement> for Statement
impl From<VariableStatement> for Statement
source§fn from(item: VariableStatement) -> Statement
fn from(item: VariableStatement) -> Statement
Converts to this type from the input type.
source§impl From<WhileStatement> for Statement
impl From<WhileStatement> for Statement
source§fn from(item: WhileStatement) -> Statement
fn from(item: WhileStatement) -> Statement
Converts to this type from the input type.
source§impl PartialEq<Statement> for Statement
impl PartialEq<Statement> for Statement
source§impl SelfRustTokenize for Statement
impl SelfRustTokenize for Statement
fn append_to_token_stream(&self, token_stream: &mut TokenStream)
source§fn to_tokens(&self) -> TokenStream
fn to_tokens(&self) -> TokenStream
Returns the tokens used to construct self
source§impl<'try_into_ref> TryInto<&'try_into_ref DeclareFunctionDeclaration> for &'try_into_ref Statement
impl<'try_into_ref> TryInto<&'try_into_ref DeclareFunctionDeclaration> for &'try_into_ref Statement
source§impl<'try_into_ref> TryInto<&'try_into_ref DeclareVariableDeclaration> for &'try_into_ref Statement
impl<'try_into_ref> TryInto<&'try_into_ref DeclareVariableDeclaration> for &'try_into_ref Statement
source§impl<'try_into_ref> TryInto<&'try_into_ref Decorated<ClassDeclaration<StatementPosition>>> for &'try_into_ref Statement
impl<'try_into_ref> TryInto<&'try_into_ref Decorated<ClassDeclaration<StatementPosition>>> for &'try_into_ref Statement
source§impl<'try_into_ref> TryInto<&'try_into_ref Decorated<EnumDeclaration>> for &'try_into_ref Statement
impl<'try_into_ref> TryInto<&'try_into_ref Decorated<EnumDeclaration>> for &'try_into_ref Statement
source§impl<'try_into_ref> TryInto<&'try_into_ref Decorated<ExportStatement>> for &'try_into_ref Statement
impl<'try_into_ref> TryInto<&'try_into_ref Decorated<ExportStatement>> for &'try_into_ref Statement
source§impl<'try_into_ref> TryInto<&'try_into_ref Decorated<FunctionBase<GeneralFunctionBase<StatementPosition>>>> for &'try_into_ref Statement
impl<'try_into_ref> TryInto<&'try_into_ref Decorated<FunctionBase<GeneralFunctionBase<StatementPosition>>>> for &'try_into_ref Statement
source§impl<'try_into_ref> TryInto<&'try_into_ref Decorated<InterfaceDeclaration>> for &'try_into_ref Statement
impl<'try_into_ref> TryInto<&'try_into_ref Decorated<InterfaceDeclaration>> for &'try_into_ref Statement
source§impl<'try_into_ref> TryInto<&'try_into_ref DoWhileStatement> for &'try_into_ref Statement
impl<'try_into_ref> TryInto<&'try_into_ref DoWhileStatement> for &'try_into_ref Statement
source§impl<'try_into_ref> TryInto<&'try_into_ref ExtractedFunction<GeneralFunctionBase<StatementPosition>>> for &'try_into_ref Statement
impl<'try_into_ref> TryInto<&'try_into_ref ExtractedFunction<GeneralFunctionBase<StatementPosition>>> for &'try_into_ref Statement
source§fn try_into(
self
) -> Result<&'try_into_ref ExtractedFunction<StatementFunctionBase>, Self::Error>
fn try_into( self ) -> Result<&'try_into_ref ExtractedFunction<StatementFunctionBase>, Self::Error>
Performs the conversion.
source§impl<'try_into_ref> TryInto<&'try_into_ref ForLoopStatement> for &'try_into_ref Statement
impl<'try_into_ref> TryInto<&'try_into_ref ForLoopStatement> for &'try_into_ref Statement
source§impl<'try_into_ref> TryInto<&'try_into_ref IfStatement> for &'try_into_ref Statement
impl<'try_into_ref> TryInto<&'try_into_ref IfStatement> for &'try_into_ref Statement
source§impl<'try_into_ref> TryInto<&'try_into_ref ImportStatement> for &'try_into_ref Statement
impl<'try_into_ref> TryInto<&'try_into_ref ImportStatement> for &'try_into_ref Statement
source§impl<'try_into_ref> TryInto<&'try_into_ref InterfaceDeclaration> for &'try_into_ref Statement
impl<'try_into_ref> TryInto<&'try_into_ref InterfaceDeclaration> for &'try_into_ref Statement
source§impl<'try_into_ref> TryInto<&'try_into_ref MultipleExpression> for &'try_into_ref Statement
impl<'try_into_ref> TryInto<&'try_into_ref MultipleExpression> for &'try_into_ref Statement
source§impl<'try_into_ref> TryInto<&'try_into_ref SwitchStatement> for &'try_into_ref Statement
impl<'try_into_ref> TryInto<&'try_into_ref SwitchStatement> for &'try_into_ref Statement
source§impl<'try_into_ref> TryInto<&'try_into_ref VariableStatement> for &'try_into_ref Statement
impl<'try_into_ref> TryInto<&'try_into_ref VariableStatement> for &'try_into_ref Statement
source§impl<'try_into_ref> TryInto<&'try_into_ref WhileStatement> for &'try_into_ref Statement
impl<'try_into_ref> TryInto<&'try_into_ref WhileStatement> for &'try_into_ref Statement
source§impl<'try_into_ref> TryInto<&'try_into_ref mut DeclareFunctionDeclaration> for &'try_into_ref mut Statement
impl<'try_into_ref> TryInto<&'try_into_ref mut DeclareFunctionDeclaration> for &'try_into_ref mut Statement
source§impl<'try_into_ref> TryInto<&'try_into_ref mut DeclareVariableDeclaration> for &'try_into_ref mut Statement
impl<'try_into_ref> TryInto<&'try_into_ref mut DeclareVariableDeclaration> for &'try_into_ref mut Statement
source§impl<'try_into_ref> TryInto<&'try_into_ref mut Decorated<ClassDeclaration<StatementPosition>>> for &'try_into_ref mut Statement
impl<'try_into_ref> TryInto<&'try_into_ref mut Decorated<ClassDeclaration<StatementPosition>>> for &'try_into_ref mut Statement
source§impl<'try_into_ref> TryInto<&'try_into_ref mut Decorated<EnumDeclaration>> for &'try_into_ref mut Statement
impl<'try_into_ref> TryInto<&'try_into_ref mut Decorated<EnumDeclaration>> for &'try_into_ref mut Statement
source§impl<'try_into_ref> TryInto<&'try_into_ref mut Decorated<ExportStatement>> for &'try_into_ref mut Statement
impl<'try_into_ref> TryInto<&'try_into_ref mut Decorated<ExportStatement>> for &'try_into_ref mut Statement
source§impl<'try_into_ref> TryInto<&'try_into_ref mut Decorated<FunctionBase<GeneralFunctionBase<StatementPosition>>>> for &'try_into_ref mut Statement
impl<'try_into_ref> TryInto<&'try_into_ref mut Decorated<FunctionBase<GeneralFunctionBase<StatementPosition>>>> for &'try_into_ref mut Statement
source§impl<'try_into_ref> TryInto<&'try_into_ref mut Decorated<InterfaceDeclaration>> for &'try_into_ref mut Statement
impl<'try_into_ref> TryInto<&'try_into_ref mut Decorated<InterfaceDeclaration>> for &'try_into_ref mut Statement
source§impl<'try_into_ref> TryInto<&'try_into_ref mut DoWhileStatement> for &'try_into_ref mut Statement
impl<'try_into_ref> TryInto<&'try_into_ref mut DoWhileStatement> for &'try_into_ref mut Statement
source§impl<'try_into_ref> TryInto<&'try_into_ref mut ExtractedFunction<GeneralFunctionBase<StatementPosition>>> for &'try_into_ref mut Statement
impl<'try_into_ref> TryInto<&'try_into_ref mut ExtractedFunction<GeneralFunctionBase<StatementPosition>>> for &'try_into_ref mut Statement
source§fn try_into(
self
) -> Result<&'try_into_ref mut ExtractedFunction<StatementFunctionBase>, Self::Error>
fn try_into( self ) -> Result<&'try_into_ref mut ExtractedFunction<StatementFunctionBase>, Self::Error>
Performs the conversion.