Skip to main content

NodeData

Enum NodeData 

Source
pub enum NodeData {
Show 42 variants Block, Group, Empty, Yield, ExprStmt, VarDecl { name: String, ty: JType, final_mod: bool, }, Assign { op: Option<BinOp>, }, If, While, DoWhile, For { inits: u8, has_cond: bool, steps: u8, }, ForEach { name: String, ty: JType, }, Return, Break { label: Option<String>, }, Continue { label: Option<String>, }, Throw, Try, Catch { ty_raw: String, name: String, }, Synchronized, Switch, Case { labels: u16, is_default: bool, arrow: bool, }, Label { name: String, }, Assert, Raw { text: String, }, Binary { op: BinOp, }, Unary { op: UnOp, }, Call, Member { name: Sym, }, Index, Cast { ty: JType, }, Paren, Ternary, New { ty: JType, anon_raw: Option<String>, }, NewArray { ty: JType, dims: u16, sized: u16, }, ArrayLit, VarRef { name: Sym, }, Literal(Lit), This, Super, InstanceOf { ty: JType, bind: Option<String>, }, Lambda { params_raw: String, }, MethodRef { name: Sym, },
}
Expand description

节点负载:children 统一放在 Node::children,这里只放非节点数据。

Variants§

§

Block

§

Group

合成分组(无花括号、无作用域):多声明符等“一句多语句“的承载。 语句列表处在解析期就地展开;若存活到打印,按同缩进无括号输出。 kind() 映射为 Block(引擎规则透明),但语义上不引入词法作用域。

§

Empty

§

Yield

yield expr;(switch 表达式产出)。孩子 [expr]。

§

ExprStmt

§

VarDecl

Fields

§name: String
§final_mod: bool
§

Assign

Fields

§

If

§

While

§

DoWhile

§

For

Fields

§inits: u8
§has_cond: bool
§steps: u8
§

ForEach

Fields

§name: String
§

Return

§

Break

Fields

§

Continue

Fields

§

Throw

§

Try

children: [resource…, try_block, catch…, (finally)?]

§

Catch

catch (ty_raw name),children: [block]

Fields

§ty_raw: String
§name: String
§

Synchronized

children: [lock, block]

§

Switch

children: [subject, case…]

§

Case

children: [label…, stmts…](前 labels 个是 case 标签表达式)

Fields

§labels: u16
§is_default: bool
§arrow: bool
§

Label

children: [stmt]

Fields

§name: String
§

Assert

children: [cond, (msg)?]

§

Raw

不可解析的原文区域:原样保留,简化规则不触碰。

Fields

§text: String
§

Binary

Fields

§

Unary

Fields

§op: UnOp
§

Call

children: [callee, arg…]

§

Member

children: [object];name 为成员名。

Fields

§name: Sym
§

Index

children: [array, index]

§

Cast

Fields

§

Paren

§

Ternary

§

New

new T(args…);匿名类体以原文附加。

Fields

§anon_raw: Option<String>
§

NewArray

new T[sz…][]… [init];ty 为元素类型,dims=总维数,sized=带尺寸维数; children: [size…, (ArrayLit)?]

Fields

§dims: u16
§sized: u16
§

ArrayLit

§

VarRef

Fields

§name: Sym
§

Literal(Lit)

§

This

§

Super

super(super.foo() / super(args) 的 callee)

§

InstanceOf

children: [expr];x instanceof T bind

Fields

§

Lambda

children: [body](body 为 Block 或表达式)

Fields

§params_raw: String
§

MethodRef

children: [receiver];recv::name(name 含 new)

Fields

§name: Sym

Trait Implementations§

Source§

impl Clone for NodeData

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for NodeData

Source§

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

Formats the value using the given formatter. Read more
Source§

impl PartialEq for NodeData

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for NodeData

Auto Trait Implementations§

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, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.