dora_parser::ast

Enum Expr

Source
pub enum Expr {
Show 23 variants ExprUn(ExprUnType), ExprBin(ExprBinType), ExprLitChar(ExprLitCharType), ExprLitInt(ExprLitIntType), ExprLitFloat(ExprLitFloatType), ExprLitStr(ExprLitStrType), ExprTemplate(ExprTemplateType), ExprLitBool(ExprLitBoolType), ExprIdent(ExprIdentType), ExprCall(ExprCallType), ExprTypeParam(ExprTypeParamType), ExprPath(ExprPathType), ExprDelegation(ExprDelegationType), ExprDot(ExprDotType), ExprSelf(ExprSelfType), ExprSuper(ExprSuperType), ExprNil(ExprNilType), ExprConv(ExprConvType), ExprTry(ExprTryType), ExprLambda(ExprLambdaType), ExprBlock(ExprBlockType), ExprIf(ExprIfType), ExprTuple(ExprTupleType),
}

Variants§

§

ExprUn(ExprUnType)

§

ExprBin(ExprBinType)

§

ExprLitChar(ExprLitCharType)

§

ExprLitInt(ExprLitIntType)

§

ExprLitFloat(ExprLitFloatType)

§

ExprLitStr(ExprLitStrType)

§

ExprTemplate(ExprTemplateType)

§

ExprLitBool(ExprLitBoolType)

§

ExprIdent(ExprIdentType)

§

ExprCall(ExprCallType)

§

ExprTypeParam(ExprTypeParamType)

§

ExprPath(ExprPathType)

§

ExprDelegation(ExprDelegationType)

§

ExprDot(ExprDotType)

§

ExprSelf(ExprSelfType)

§

ExprSuper(ExprSuperType)

§

ExprNil(ExprNilType)

§

ExprConv(ExprConvType)

§

ExprTry(ExprTryType)

§

ExprLambda(ExprLambdaType)

§

ExprBlock(ExprBlockType)

§

ExprIf(ExprIfType)

§

ExprTuple(ExprTupleType)

Implementations§

Source§

impl Expr

Source

pub fn create_block( id: NodeId, pos: Position, span: Span, stmts: Vec<Box<Stmt>>, expr: Option<Box<Expr>>, ) -> Expr

Source

pub fn create_if( id: NodeId, pos: Position, span: Span, cond: Box<Expr>, then_block: Box<Expr>, else_block: Option<Box<Expr>>, ) -> Expr

Source

pub fn create_un( id: NodeId, pos: Position, span: Span, op: UnOp, opnd: Box<Expr>, ) -> Expr

Source

pub fn create_try( id: NodeId, pos: Position, span: Span, expr: Box<Expr>, mode: TryMode, ) -> Expr

Source

pub fn create_bin( id: NodeId, pos: Position, span: Span, op: BinOp, lhs: Box<Expr>, rhs: Box<Expr>, ) -> Expr

Source

pub fn create_conv( id: NodeId, pos: Position, span: Span, object: Box<Expr>, data_type: Box<Type>, is: bool, ) -> Expr

Source

pub fn create_lit_char( id: NodeId, pos: Position, span: Span, value: char, ) -> Expr

Source

pub fn create_lit_int( id: NodeId, pos: Position, span: Span, value: u64, base: IntBase, suffix: IntSuffix, ) -> Expr

Source

pub fn create_lit_float( id: NodeId, pos: Position, span: Span, value: f64, suffix: FloatSuffix, ) -> Expr

Source

pub fn create_lit_str( id: NodeId, pos: Position, span: Span, value: String, ) -> Expr

Source

pub fn create_template( id: NodeId, pos: Position, span: Span, parts: Vec<Box<Expr>>, ) -> Expr

Source

pub fn create_lit_bool( id: NodeId, pos: Position, span: Span, value: bool, ) -> Expr

Source

pub fn create_this(id: NodeId, pos: Position, span: Span) -> Expr

Source

pub fn create_super(id: NodeId, pos: Position, span: Span) -> Expr

Source

pub fn create_nil(id: NodeId, pos: Position, span: Span) -> Expr

Source

pub fn create_ident( id: NodeId, pos: Position, span: Span, name: Name, type_params: Option<Vec<Type>>, ) -> Expr

Source

pub fn create_call( id: NodeId, pos: Position, span: Span, callee: Box<Expr>, args: Vec<Box<Expr>>, ) -> Expr

Source

pub fn create_type_param( id: NodeId, pos: Position, span: Span, callee: Box<Expr>, args: Vec<Type>, ) -> Expr

Source

pub fn create_path( id: NodeId, pos: Position, span: Span, lhs: Box<Expr>, rhs: Box<Expr>, ) -> Expr

Source

pub fn create_delegation( id: NodeId, pos: Position, span: Span, args: Vec<Box<Expr>>, ) -> Expr

Source

pub fn create_dot( id: NodeId, pos: Position, span: Span, lhs: Box<Expr>, rhs: Box<Expr>, ) -> Expr

Source

pub fn create_lambda( id: NodeId, pos: Position, span: Span, params: Vec<Param>, ret: Option<Box<Type>>, block: Box<Stmt>, ) -> Expr

Source

pub fn create_tuple( id: NodeId, pos: Position, span: Span, values: Vec<Box<Expr>>, ) -> Expr

Source

pub fn to_un(&self) -> Option<&ExprUnType>

Source

pub fn is_un(&self) -> bool

Source

pub fn to_bin(&self) -> Option<&ExprBinType>

Source

pub fn is_bin(&self) -> bool

Source

pub fn to_ident(&self) -> Option<&ExprIdentType>

Source

pub fn is_ident(&self) -> bool

Source

pub fn to_call(&self) -> Option<&ExprCallType>

Source

pub fn is_call(&self) -> bool

Source

pub fn to_path(&self) -> Option<&ExprPathType>

Source

pub fn is_path(&self) -> bool

Source

pub fn to_type_param(&self) -> Option<&ExprTypeParamType>

Source

pub fn is_type_param(&self) -> bool

Source

pub fn to_lit_char(&self) -> Option<&ExprLitCharType>

Source

pub fn is_lit_char(&self) -> bool

Source

pub fn to_lit_int(&self) -> Option<&ExprLitIntType>

Source

pub fn is_lit_int(&self) -> bool

Source

pub fn to_template(&self) -> Option<&ExprTemplateType>

Source

pub fn is_template(&self) -> bool

Source

pub fn to_lit_float(&self) -> Option<&ExprLitFloatType>

Source

pub fn is_lit_float(&self) -> bool

Source

pub fn to_lit_str(&self) -> Option<&ExprLitStrType>

Source

pub fn is_lit_str(&self) -> bool

Source

pub fn to_lit_bool(&self) -> Option<&ExprLitBoolType>

Source

pub fn is_lit_bool(&self) -> bool

Source

pub fn is_lit_true(&self) -> bool

Source

pub fn to_dot(&self) -> Option<&ExprDotType>

Source

pub fn is_dot(&self) -> bool

Source

pub fn to_delegation(&self) -> Option<&ExprDelegationType>

Source

pub fn is_delegation(&self) -> bool

Source

pub fn is_this(&self) -> bool

Source

pub fn is_super(&self) -> bool

Source

pub fn to_super(&self) -> Option<&ExprSuperType>

Source

pub fn is_nil(&self) -> bool

Source

pub fn to_conv(&self) -> Option<&ExprConvType>

Source

pub fn is_conv(&self) -> bool

Source

pub fn to_try(&self) -> Option<&ExprTryType>

Source

pub fn is_try(&self) -> bool

Source

pub fn to_lambda(&self) -> Option<&ExprLambdaType>

Source

pub fn is_lambda(&self) -> bool

Source

pub fn to_tuple(&self) -> Option<&ExprTupleType>

Source

pub fn is_tuple(&self) -> bool

Source

pub fn to_block(&self) -> Option<&ExprBlockType>

Source

pub fn is_block(&self) -> bool

Source

pub fn to_if(&self) -> Option<&ExprIfType>

Source

pub fn is_if(&self) -> bool

Source

pub fn needs_semicolon(&self) -> bool

Source

pub fn pos(&self) -> Position

Source

pub fn span(&self) -> Span

Source

pub fn id(&self) -> NodeId

Trait Implementations§

Source§

impl Clone for Expr

Source§

fn clone(&self) -> Expr

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Expr

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Expr

§

impl RefUnwindSafe for Expr

§

impl Send for Expr

§

impl Sync for Expr

§

impl Unpin for Expr

§

impl UnwindSafe for Expr

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Erased for T