1234#![allow(non_snake_case, clippy::match_like_matches_macro)]5use crate::{6 ast::{support, AstChildren, AstNode, AstToken},7 SyntaxKind::{self, *},8 SyntaxNode, SyntaxToken, T,9};1011#[derive(Debug, Clone, PartialEq, Eq, Hash)]12pub struct SourceFile {13 pub(crate) syntax: SyntaxNode,14}15impl SourceFile {16 pub fn expr(&self) -> Option<Expr> {17 support::child(&self.syntax)18 }19}2021#[derive(Debug, Clone, PartialEq, Eq, Hash)]22pub struct Expr {23 pub(crate) syntax: SyntaxNode,24}25impl Expr {26 pub fn stmt_locals(&self) -> AstChildren<StmtLocal> {27 support::children(&self.syntax)28 }29 pub fn expr_base(&self) -> Option<ExprBase> {30 support::child(&self.syntax)31 }32}3334#[derive(Debug, Clone, PartialEq, Eq, Hash)]35pub struct ExprBinary {36 pub(crate) syntax: SyntaxNode,37}38impl ExprBinary {39 pub fn lhs(&self) -> Option<LhsExpr> {40 support::child(&self.syntax)41 }42 pub fn binary_operator(&self) -> Option<BinaryOperator> {43 support::token_child(&self.syntax)44 }45 pub fn rhs(&self) -> Option<Expr> {46 support::child(&self.syntax)47 }48}4950#[derive(Debug, Clone, PartialEq, Eq, Hash)]51pub struct LhsExpr {52 pub(crate) syntax: SyntaxNode,53}54impl LhsExpr {55 pub fn expr(&self) -> Option<Expr> {56 support::child(&self.syntax)57 }58}5960#[derive(Debug, Clone, PartialEq, Eq, Hash)]61pub struct ExprUnary {62 pub(crate) syntax: SyntaxNode,63}64impl ExprUnary {65 pub fn unary_operator(&self) -> Option<UnaryOperator> {66 support::token_child(&self.syntax)67 }68 pub fn rhs(&self) -> Option<Expr> {69 support::child(&self.syntax)70 }71}7273#[derive(Debug, Clone, PartialEq, Eq, Hash)]74pub struct ExprSlice {75 pub(crate) syntax: SyntaxNode,76}77impl ExprSlice {78 pub fn expr(&self) -> Option<Expr> {79 support::child(&self.syntax)80 }81 pub fn slice_desc(&self) -> Option<SliceDesc> {82 support::child(&self.syntax)83 }84}8586#[derive(Debug, Clone, PartialEq, Eq, Hash)]87pub struct SliceDesc {88 pub(crate) syntax: SyntaxNode,89}90impl SliceDesc {91 pub fn l_brack_token(&self) -> Option<SyntaxToken> {92 support::token(&self.syntax, T!['['])93 }94 pub fn from(&self) -> Option<Expr> {95 support::child(&self.syntax)96 }97 pub fn colon_token(&self) -> Option<SyntaxToken> {98 support::token(&self.syntax, T![:])99 }100 pub fn end(&self) -> Option<SliceDescEnd> {101 support::child(&self.syntax)102 }103 pub fn step(&self) -> Option<SliceDescStep> {104 support::child(&self.syntax)105 }106 pub fn r_brack_token(&self) -> Option<SyntaxToken> {107 support::token(&self.syntax, T![']'])108 }109}110111#[derive(Debug, Clone, PartialEq, Eq, Hash)]112pub struct ExprIndex {113 pub(crate) syntax: SyntaxNode,114}115impl ExprIndex {116 pub fn expr(&self) -> Option<Expr> {117 support::child(&self.syntax)118 }119 pub fn dot_token(&self) -> Option<SyntaxToken> {120 support::token(&self.syntax, T![.])121 }122 pub fn index(&self) -> Option<Name> {123 support::child(&self.syntax)124 }125}126127#[derive(Debug, Clone, PartialEq, Eq, Hash)]128pub struct Name {129 pub(crate) syntax: SyntaxNode,130}131impl Name {132 pub fn ident_lit(&self) -> Option<SyntaxToken> {133 support::token(&self.syntax, IDENT)134 }135}136137#[derive(Debug, Clone, PartialEq, Eq, Hash)]138pub struct ExprIndexExpr {139 pub(crate) syntax: SyntaxNode,140}141impl ExprIndexExpr {142 pub fn base(&self) -> Option<LhsExpr> {143 support::child(&self.syntax)144 }145 pub fn l_brack_token(&self) -> Option<SyntaxToken> {146 support::token(&self.syntax, T!['['])147 }148 pub fn index(&self) -> Option<Expr> {149 support::child(&self.syntax)150 }151 pub fn r_brack_token(&self) -> Option<SyntaxToken> {152 support::token(&self.syntax, T![']'])153 }154}155156#[derive(Debug, Clone, PartialEq, Eq, Hash)]157pub struct ExprApply {158 pub(crate) syntax: SyntaxNode,159}160impl ExprApply {161 pub fn expr(&self) -> Option<Expr> {162 support::child(&self.syntax)163 }164 pub fn args_desc(&self) -> Option<ArgsDesc> {165 support::child(&self.syntax)166 }167 pub fn tailstrict_kw_token(&self) -> Option<SyntaxToken> {168 support::token(&self.syntax, T![tailstrict])169 }170}171172#[derive(Debug, Clone, PartialEq, Eq, Hash)]173pub struct ArgsDesc {174 pub(crate) syntax: SyntaxNode,175}176impl ArgsDesc {177 pub fn l_paren_token(&self) -> Option<SyntaxToken> {178 support::token(&self.syntax, T!['('])179 }180 pub fn args(&self) -> AstChildren<Arg> {181 support::children(&self.syntax)182 }183 pub fn r_paren_token(&self) -> Option<SyntaxToken> {184 support::token(&self.syntax, T![')'])185 }186}187188#[derive(Debug, Clone, PartialEq, Eq, Hash)]189pub struct ExprObjExtend {190 pub(crate) syntax: SyntaxNode,191}192impl ExprObjExtend {193 pub fn lhs_expr(&self) -> Option<LhsExpr> {194 support::child(&self.syntax)195 }196 pub fn expr(&self) -> Option<Expr> {197 support::child(&self.syntax)198 }199}200201#[derive(Debug, Clone, PartialEq, Eq, Hash)]202pub struct ExprParened {203 pub(crate) syntax: SyntaxNode,204}205impl ExprParened {206 pub fn l_paren_token(&self) -> Option<SyntaxToken> {207 support::token(&self.syntax, T!['('])208 }209 pub fn expr(&self) -> Option<Expr> {210 support::child(&self.syntax)211 }212 pub fn r_paren_token(&self) -> Option<SyntaxToken> {213 support::token(&self.syntax, T![')'])214 }215}216217#[derive(Debug, Clone, PartialEq, Eq, Hash)]218pub struct ExprLiteral {219 pub(crate) syntax: SyntaxNode,220}221impl ExprLiteral {222 pub fn literal(&self) -> Option<Literal> {223 support::token_child(&self.syntax)224 }225}226227#[derive(Debug, Clone, PartialEq, Eq, Hash)]228pub struct ExprString {229 pub(crate) syntax: SyntaxNode,230}231impl ExprString {232 pub fn text(&self) -> Option<Text> {233 support::token_child(&self.syntax)234 }235}236237#[derive(Debug, Clone, PartialEq, Eq, Hash)]238pub struct ExprNumber {239 pub(crate) syntax: SyntaxNode,240}241impl ExprNumber {242 pub fn number(&self) -> Option<Number> {243 support::token_child(&self.syntax)244 }245}246247#[derive(Debug, Clone, PartialEq, Eq, Hash)]248pub struct ExprArray {249 pub(crate) syntax: SyntaxNode,250}251impl ExprArray {252 pub fn l_brack_token(&self) -> Option<SyntaxToken> {253 support::token(&self.syntax, T!['['])254 }255 pub fn exprs(&self) -> AstChildren<Expr> {256 support::children(&self.syntax)257 }258 pub fn r_brack_token(&self) -> Option<SyntaxToken> {259 support::token(&self.syntax, T![']'])260 }261}262263#[derive(Debug, Clone, PartialEq, Eq, Hash)]264pub struct ExprObject {265 pub(crate) syntax: SyntaxNode,266}267impl ExprObject {268 pub fn obj_body(&self) -> Option<ObjBody> {269 support::child(&self.syntax)270 }271}272273#[derive(Debug, Clone, PartialEq, Eq, Hash)]274pub struct ExprArrayComp {275 pub(crate) syntax: SyntaxNode,276}277impl ExprArrayComp {278 pub fn l_brack_token(&self) -> Option<SyntaxToken> {279 support::token(&self.syntax, T!['['])280 }281 pub fn expr(&self) -> Option<Expr> {282 support::child(&self.syntax)283 }284 pub fn comma_token(&self) -> Option<SyntaxToken> {285 support::token(&self.syntax, T![,])286 }287 pub fn comp_specs(&self) -> AstChildren<CompSpec> {288 support::children(&self.syntax)289 }290 pub fn r_brack_token(&self) -> Option<SyntaxToken> {291 support::token(&self.syntax, T![']'])292 }293}294295#[derive(Debug, Clone, PartialEq, Eq, Hash)]296pub struct ExprImport {297 pub(crate) syntax: SyntaxNode,298}299impl ExprImport {300 pub fn import_kind(&self) -> Option<ImportKind> {301 support::token_child(&self.syntax)302 }303 pub fn text(&self) -> Option<Text> {304 support::token_child(&self.syntax)305 }306}307308#[derive(Debug, Clone, PartialEq, Eq, Hash)]309pub struct ExprVar {310 pub(crate) syntax: SyntaxNode,311}312impl ExprVar {313 pub fn name(&self) -> Option<Name> {314 support::child(&self.syntax)315 }316}317318#[derive(Debug, Clone, PartialEq, Eq, Hash)]319pub struct ExprIfThenElse {320 pub(crate) syntax: SyntaxNode,321}322impl ExprIfThenElse {323 pub fn if_kw_token(&self) -> Option<SyntaxToken> {324 support::token(&self.syntax, T![if])325 }326 pub fn cond(&self) -> Option<Expr> {327 support::child(&self.syntax)328 }329 pub fn then_kw_token(&self) -> Option<SyntaxToken> {330 support::token(&self.syntax, T![then])331 }332 pub fn then(&self) -> Option<TrueExpr> {333 support::child(&self.syntax)334 }335 pub fn else_kw_token(&self) -> Option<SyntaxToken> {336 support::token(&self.syntax, T![else])337 }338 pub fn else_(&self) -> Option<FalseExpr> {339 support::child(&self.syntax)340 }341}342343#[derive(Debug, Clone, PartialEq, Eq, Hash)]344pub struct TrueExpr {345 pub(crate) syntax: SyntaxNode,346}347impl TrueExpr {348 pub fn expr(&self) -> Option<Expr> {349 support::child(&self.syntax)350 }351}352353#[derive(Debug, Clone, PartialEq, Eq, Hash)]354pub struct FalseExpr {355 pub(crate) syntax: SyntaxNode,356}357impl FalseExpr {358 pub fn expr(&self) -> Option<Expr> {359 support::child(&self.syntax)360 }361}362363#[derive(Debug, Clone, PartialEq, Eq, Hash)]364pub struct ExprFunction {365 pub(crate) syntax: SyntaxNode,366}367impl ExprFunction {368 pub fn function_kw_token(&self) -> Option<SyntaxToken> {369 support::token(&self.syntax, T![function])370 }371 pub fn l_paren_token(&self) -> Option<SyntaxToken> {372 support::token(&self.syntax, T!['('])373 }374 pub fn params_desc(&self) -> Option<ParamsDesc> {375 support::child(&self.syntax)376 }377 pub fn r_paren_token(&self) -> Option<SyntaxToken> {378 support::token(&self.syntax, T![')'])379 }380 pub fn expr(&self) -> Option<Expr> {381 support::child(&self.syntax)382 }383}384385#[derive(Debug, Clone, PartialEq, Eq, Hash)]386pub struct ParamsDesc {387 pub(crate) syntax: SyntaxNode,388}389impl ParamsDesc {390 pub fn l_paren_token(&self) -> Option<SyntaxToken> {391 support::token(&self.syntax, T!['('])392 }393 pub fn params(&self) -> AstChildren<Param> {394 support::children(&self.syntax)395 }396 pub fn r_paren_token(&self) -> Option<SyntaxToken> {397 support::token(&self.syntax, T![')'])398 }399}400401#[derive(Debug, Clone, PartialEq, Eq, Hash)]402pub struct ExprAssert {403 pub(crate) syntax: SyntaxNode,404}405impl ExprAssert {406 pub fn assertion(&self) -> Option<Assertion> {407 support::child(&self.syntax)408 }409 pub fn semi_token(&self) -> Option<SyntaxToken> {410 support::token(&self.syntax, T![;])411 }412 pub fn expr(&self) -> Option<Expr> {413 support::child(&self.syntax)414 }415}416417#[derive(Debug, Clone, PartialEq, Eq, Hash)]418pub struct Assertion {419 pub(crate) syntax: SyntaxNode,420}421impl Assertion {422 pub fn assert_kw_token(&self) -> Option<SyntaxToken> {423 support::token(&self.syntax, T![assert])424 }425 pub fn condition(&self) -> Option<LhsExpr> {426 support::child(&self.syntax)427 }428 pub fn colon_token(&self) -> Option<SyntaxToken> {429 support::token(&self.syntax, T![:])430 }431 pub fn message(&self) -> Option<Expr> {432 support::child(&self.syntax)433 }434}435436#[derive(Debug, Clone, PartialEq, Eq, Hash)]437pub struct ExprError {438 pub(crate) syntax: SyntaxNode,439}440impl ExprError {441 pub fn error_kw_token(&self) -> Option<SyntaxToken> {442 support::token(&self.syntax, T![error])443 }444 pub fn expr(&self) -> Option<Expr> {445 support::child(&self.syntax)446 }447}448449#[derive(Debug, Clone, PartialEq, Eq, Hash)]450pub struct StmtLocal {451 pub(crate) syntax: SyntaxNode,452}453impl StmtLocal {454 pub fn local_kw_token(&self) -> Option<SyntaxToken> {455 support::token(&self.syntax, T![local])456 }457 pub fn binds(&self) -> AstChildren<Bind> {458 support::children(&self.syntax)459 }460 pub fn semi_token(&self) -> Option<SyntaxToken> {461 support::token(&self.syntax, T![;])462 }463}464465#[derive(Debug, Clone, PartialEq, Eq, Hash)]466pub struct SliceDescEnd {467 pub(crate) syntax: SyntaxNode,468}469impl SliceDescEnd {470 pub fn expr(&self) -> Option<Expr> {471 support::child(&self.syntax)472 }473}474475#[derive(Debug, Clone, PartialEq, Eq, Hash)]476pub struct SliceDescStep {477 pub(crate) syntax: SyntaxNode,478}479impl SliceDescStep {480 pub fn expr(&self) -> Option<Expr> {481 support::child(&self.syntax)482 }483}484485#[derive(Debug, Clone, PartialEq, Eq, Hash)]486pub struct Arg {487 pub(crate) syntax: SyntaxNode,488}489impl Arg {490 pub fn name(&self) -> Option<Name> {491 support::child(&self.syntax)492 }493 pub fn assign_token(&self) -> Option<SyntaxToken> {494 support::token(&self.syntax, T![=])495 }496 pub fn expr(&self) -> Option<Expr> {497 support::child(&self.syntax)498 }499}500501#[derive(Debug, Clone, PartialEq, Eq, Hash)]502pub struct ObjBodyComp {503 pub(crate) syntax: SyntaxNode,504}505impl ObjBodyComp {506 pub fn l_brace_token(&self) -> Option<SyntaxToken> {507 support::token(&self.syntax, T!['{'])508 }509 pub fn member_comps(&self) -> AstChildren<MemberComp> {510 support::children(&self.syntax)511 }512 pub fn comp_specs(&self) -> AstChildren<CompSpec> {513 support::children(&self.syntax)514 }515 pub fn r_brace_token(&self) -> Option<SyntaxToken> {516 support::token(&self.syntax, T!['}'])517 }518}519520#[derive(Debug, Clone, PartialEq, Eq, Hash)]521pub struct ObjBodyMemberList {522 pub(crate) syntax: SyntaxNode,523}524impl ObjBodyMemberList {525 pub fn l_brace_token(&self) -> Option<SyntaxToken> {526 support::token(&self.syntax, T!['{'])527 }528 pub fn members(&self) -> AstChildren<Member> {529 support::children(&self.syntax)530 }531 pub fn r_brace_token(&self) -> Option<SyntaxToken> {532 support::token(&self.syntax, T!['}'])533 }534}535536#[derive(Debug, Clone, PartialEq, Eq, Hash)]537pub struct MemberBindStmt {538 pub(crate) syntax: SyntaxNode,539}540impl MemberBindStmt {541 pub fn obj_local(&self) -> Option<ObjLocal> {542 support::child(&self.syntax)543 }544}545546#[derive(Debug, Clone, PartialEq, Eq, Hash)]547pub struct ObjLocal {548 pub(crate) syntax: SyntaxNode,549}550impl ObjLocal {551 pub fn local_kw_token(&self) -> Option<SyntaxToken> {552 support::token(&self.syntax, T![local])553 }554 pub fn bind(&self) -> Option<Bind> {555 support::child(&self.syntax)556 }557}558559#[derive(Debug, Clone, PartialEq, Eq, Hash)]560pub struct MemberAssertStmt {561 pub(crate) syntax: SyntaxNode,562}563impl MemberAssertStmt {564 pub fn assertion(&self) -> Option<Assertion> {565 support::child(&self.syntax)566 }567}568569#[derive(Debug, Clone, PartialEq, Eq, Hash)]570pub struct MemberFieldNormal {571 pub(crate) syntax: SyntaxNode,572}573impl MemberFieldNormal {574 pub fn field_name(&self) -> Option<FieldName> {575 support::child(&self.syntax)576 }577 pub fn plus_token(&self) -> Option<SyntaxToken> {578 support::token(&self.syntax, T![+])579 }580 pub fn visibility(&self) -> Option<Visibility> {581 support::token_child(&self.syntax)582 }583 pub fn expr(&self) -> Option<Expr> {584 support::child(&self.syntax)585 }586}587588#[derive(Debug, Clone, PartialEq, Eq, Hash)]589pub struct MemberFieldMethod {590 pub(crate) syntax: SyntaxNode,591}592impl MemberFieldMethod {593 pub fn field_name(&self) -> Option<FieldName> {594 support::child(&self.syntax)595 }596 pub fn params_desc(&self) -> Option<ParamsDesc> {597 support::child(&self.syntax)598 }599 pub fn visibility(&self) -> Option<Visibility> {600 support::token_child(&self.syntax)601 }602 pub fn expr(&self) -> Option<Expr> {603 support::child(&self.syntax)604 }605}606607#[derive(Debug, Clone, PartialEq, Eq, Hash)]608pub struct FieldNameFixed {609 pub(crate) syntax: SyntaxNode,610}611impl FieldNameFixed {612 pub fn id(&self) -> Option<Name> {613 support::child(&self.syntax)614 }615 pub fn text(&self) -> Option<Text> {616 support::token_child(&self.syntax)617 }618}619620#[derive(Debug, Clone, PartialEq, Eq, Hash)]621pub struct FieldNameDynamic {622 pub(crate) syntax: SyntaxNode,623}624impl FieldNameDynamic {625 pub fn l_brack_token(&self) -> Option<SyntaxToken> {626 support::token(&self.syntax, T!['['])627 }628 pub fn expr(&self) -> Option<Expr> {629 support::child(&self.syntax)630 }631 pub fn r_brack_token(&self) -> Option<SyntaxToken> {632 support::token(&self.syntax, T![']'])633 }634}635636#[derive(Debug, Clone, PartialEq, Eq, Hash)]637pub struct ForSpec {638 pub(crate) syntax: SyntaxNode,639}640impl ForSpec {641 pub fn for_kw_token(&self) -> Option<SyntaxToken> {642 support::token(&self.syntax, T![for])643 }644 pub fn bind(&self) -> Option<Name> {645 support::child(&self.syntax)646 }647 pub fn in_kw_token(&self) -> Option<SyntaxToken> {648 support::token(&self.syntax, T![in])649 }650 pub fn expr(&self) -> Option<Expr> {651 support::child(&self.syntax)652 }653}654655#[derive(Debug, Clone, PartialEq, Eq, Hash)]656pub struct IfSpec {657 pub(crate) syntax: SyntaxNode,658}659impl IfSpec {660 pub fn if_kw_token(&self) -> Option<SyntaxToken> {661 support::token(&self.syntax, T![if])662 }663 pub fn expr(&self) -> Option<Expr> {664 support::child(&self.syntax)665 }666}667668#[derive(Debug, Clone, PartialEq, Eq, Hash)]669pub struct BindDestruct {670 pub(crate) syntax: SyntaxNode,671}672impl BindDestruct {673 pub fn into(&self) -> Option<Destruct> {674 support::child(&self.syntax)675 }676 pub fn assign_token(&self) -> Option<SyntaxToken> {677 support::token(&self.syntax, T![=])678 }679 pub fn value(&self) -> Option<Expr> {680 support::child(&self.syntax)681 }682}683684#[derive(Debug, Clone, PartialEq, Eq, Hash)]685pub struct BindFunction {686 pub(crate) syntax: SyntaxNode,687}688impl BindFunction {689 pub fn name(&self) -> Option<Name> {690 support::child(&self.syntax)691 }692 pub fn params(&self) -> Option<ParamsDesc> {693 support::child(&self.syntax)694 }695 pub fn assign_token(&self) -> Option<SyntaxToken> {696 support::token(&self.syntax, T![=])697 }698 pub fn value(&self) -> Option<Expr> {699 support::child(&self.syntax)700 }701}702703#[derive(Debug, Clone, PartialEq, Eq, Hash)]704pub struct Param {705 pub(crate) syntax: SyntaxNode,706}707impl Param {708 pub fn destruct(&self) -> Option<Destruct> {709 support::child(&self.syntax)710 }711 pub fn assign_token(&self) -> Option<SyntaxToken> {712 support::token(&self.syntax, T![=])713 }714 pub fn expr(&self) -> Option<Expr> {715 support::child(&self.syntax)716 }717}718719#[derive(Debug, Clone, PartialEq, Eq, Hash)]720pub struct DestructFull {721 pub(crate) syntax: SyntaxNode,722}723impl DestructFull {724 pub fn name(&self) -> Option<Name> {725 support::child(&self.syntax)726 }727}728729#[derive(Debug, Clone, PartialEq, Eq, Hash)]730pub struct DestructSkip {731 pub(crate) syntax: SyntaxNode,732}733impl DestructSkip {734 pub fn question_mark_token(&self) -> Option<SyntaxToken> {735 support::token(&self.syntax, T![?])736 }737}738739#[derive(Debug, Clone, PartialEq, Eq, Hash)]740pub struct DestructArray {741 pub(crate) syntax: SyntaxNode,742}743impl DestructArray {744 pub fn l_brack_token(&self) -> Option<SyntaxToken> {745 support::token(&self.syntax, T!['['])746 }747 pub fn destruct_array_parts(&self) -> AstChildren<DestructArrayPart> {748 support::children(&self.syntax)749 }750 pub fn r_brack_token(&self) -> Option<SyntaxToken> {751 support::token(&self.syntax, T![']'])752 }753}754755#[derive(Debug, Clone, PartialEq, Eq, Hash)]756pub struct DestructObject {757 pub(crate) syntax: SyntaxNode,758}759impl DestructObject {760 pub fn l_brace_token(&self) -> Option<SyntaxToken> {761 support::token(&self.syntax, T!['{'])762 }763 pub fn destruct_object_fields(&self) -> AstChildren<DestructObjectField> {764 support::children(&self.syntax)765 }766 pub fn destruct_rest(&self) -> Option<DestructRest> {767 support::child(&self.syntax)768 }769 pub fn comma_token(&self) -> Option<SyntaxToken> {770 support::token(&self.syntax, T![,])771 }772 pub fn r_brace_token(&self) -> Option<SyntaxToken> {773 support::token(&self.syntax, T!['}'])774 }775}776777#[derive(Debug, Clone, PartialEq, Eq, Hash)]778pub struct DestructObjectField {779 pub(crate) syntax: SyntaxNode,780}781impl DestructObjectField {782 pub fn field(&self) -> Option<Name> {783 support::child(&self.syntax)784 }785 pub fn colon_token(&self) -> Option<SyntaxToken> {786 support::token(&self.syntax, T![:])787 }788 pub fn destruct(&self) -> Option<Destruct> {789 support::child(&self.syntax)790 }791 pub fn assign_token(&self) -> Option<SyntaxToken> {792 support::token(&self.syntax, T![=])793 }794 pub fn expr(&self) -> Option<Expr> {795 support::child(&self.syntax)796 }797}798799#[derive(Debug, Clone, PartialEq, Eq, Hash)]800pub struct DestructRest {801 pub(crate) syntax: SyntaxNode,802}803impl DestructRest {804 pub fn dotdotdot_token(&self) -> Option<SyntaxToken> {805 support::token(&self.syntax, T![...])806 }807 pub fn into(&self) -> Option<Name> {808 support::child(&self.syntax)809 }810}811812#[derive(Debug, Clone, PartialEq, Eq, Hash)]813pub struct DestructArrayElement {814 pub(crate) syntax: SyntaxNode,815}816impl DestructArrayElement {817 pub fn destruct(&self) -> Option<Destruct> {818 support::child(&self.syntax)819 }820}821822#[derive(Debug, Clone, PartialEq, Eq, Hash)]823pub enum ObjBody {824 ObjBodyComp(ObjBodyComp),825 ObjBodyMemberList(ObjBodyMemberList),826}827828#[derive(Debug, Clone, PartialEq, Eq, Hash)]829pub enum CompSpec {830 ForSpec(ForSpec),831 IfSpec(IfSpec),832}833834#[derive(Debug, Clone, PartialEq, Eq, Hash)]835pub enum Bind {836 BindDestruct(BindDestruct),837 BindFunction(BindFunction),838}839840#[derive(Debug, Clone, PartialEq, Eq, Hash)]841pub enum ExprBase {842 ExprBinary(ExprBinary),843 ExprUnary(ExprUnary),844 ExprSlice(ExprSlice),845 ExprIndex(ExprIndex),846 ExprIndexExpr(ExprIndexExpr),847 ExprApply(ExprApply),848 ExprObjExtend(ExprObjExtend),849 ExprParened(ExprParened),850 ExprString(ExprString),851 ExprNumber(ExprNumber),852 ExprLiteral(ExprLiteral),853 ExprArray(ExprArray),854 ExprObject(ExprObject),855 ExprArrayComp(ExprArrayComp),856 ExprImport(ExprImport),857 ExprVar(ExprVar),858 ExprIfThenElse(ExprIfThenElse),859 ExprFunction(ExprFunction),860 ExprAssert(ExprAssert),861 ExprError(ExprError),862}863864#[derive(Debug, Clone, PartialEq, Eq, Hash)]865pub enum MemberComp {866 MemberBindStmt(MemberBindStmt),867 MemberFieldNormal(MemberFieldNormal),868 MemberFieldMethod(MemberFieldMethod),869}870871#[derive(Debug, Clone, PartialEq, Eq, Hash)]872pub enum Member {873 MemberBindStmt(MemberBindStmt),874 MemberAssertStmt(MemberAssertStmt),875 MemberFieldNormal(MemberFieldNormal),876 MemberFieldMethod(MemberFieldMethod),877}878879#[derive(Debug, Clone, PartialEq, Eq, Hash)]880pub enum FieldName {881 FieldNameFixed(FieldNameFixed),882 FieldNameDynamic(FieldNameDynamic),883}884885#[derive(Debug, Clone, PartialEq, Eq, Hash)]886pub enum Destruct {887 DestructFull(DestructFull),888 DestructSkip(DestructSkip),889 DestructArray(DestructArray),890 DestructObject(DestructObject),891}892893#[derive(Debug, Clone, PartialEq, Eq, Hash)]894pub enum DestructArrayPart {895 DestructArrayElement(DestructArrayElement),896 DestructRest(DestructRest),897}898899#[derive(Debug, Clone, PartialEq, Eq, Hash)]900pub struct BinaryOperator {901 syntax: SyntaxToken,902 kind: BinaryOperatorKind,903}904905#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]906pub enum BinaryOperatorKind {907 Or,908 And,909 BitOr,910 BitXor,911 BitAnd,912 Eq,913 Ne,914 Lt,915 Gt,916 Le,917 Ge,918 InKw,919 Lhs,920 Rhs,921 Plus,922 Minus,923 Mul,924 Div,925 Modulo,926 MetaObjectApply,927 ErrorNoOperator,928}929930#[derive(Debug, Clone, PartialEq, Eq, Hash)]931pub struct UnaryOperator {932 syntax: SyntaxToken,933 kind: UnaryOperatorKind,934}935936#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]937pub enum UnaryOperatorKind {938 Minus,939 Not,940 BitNot,941}942943#[derive(Debug, Clone, PartialEq, Eq, Hash)]944pub struct Literal {945 syntax: SyntaxToken,946 kind: LiteralKind,947}948949#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]950pub enum LiteralKind {951 NullKw,952 TrueKw,953 FalseKw,954 SelfKw,955 Dollar,956 SuperKw,957}958959#[derive(Debug, Clone, PartialEq, Eq, Hash)]960pub struct Text {961 syntax: SyntaxToken,962 kind: TextKind,963}964965#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]966pub enum TextKind {967 StringDouble,968 ErrorStringDoubleUnterminated,969 StringSingle,970 ErrorStringSingleUnterminated,971 StringDoubleVerbatim,972 ErrorStringDoubleVerbatimUnterminated,973 StringSingleVerbatim,974 ErrorStringSingleVerbatimUnterminated,975 ErrorStringVerbatimMissingQuotes,976 StringBlock,977 ErrorStringBlockUnexpectedEnd,978 ErrorStringBlockMissingNewLine,979 ErrorStringBlockMissingTermination,980 ErrorStringBlockMissingIndent,981}982983#[derive(Debug, Clone, PartialEq, Eq, Hash)]984pub struct Number {985 syntax: SyntaxToken,986 kind: NumberKind,987}988989#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]990pub enum NumberKind {991 Float,992 ErrorFloatJunkAfterPoint,993 ErrorFloatJunkAfterExponent,994 ErrorFloatJunkAfterExponentSign,995}996997#[derive(Debug, Clone, PartialEq, Eq, Hash)]998pub struct ImportKind {999 syntax: SyntaxToken,1000 kind: ImportKindKind,1001}10021003#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]1004pub enum ImportKindKind {1005 ImportstrKw,1006 ImportbinKw,1007 ImportKw,1008}10091010#[derive(Debug, Clone, PartialEq, Eq, Hash)]1011pub struct Visibility {1012 syntax: SyntaxToken,1013 kind: VisibilityKind,1014}10151016#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]1017pub enum VisibilityKind {1018 Coloncoloncolon,1019 Coloncolon,1020 Colon,1021}10221023#[derive(Debug, Clone, PartialEq, Eq, Hash)]1024pub struct Trivia {1025 syntax: SyntaxToken,1026 kind: TriviaKind,1027}10281029#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]1030pub enum TriviaKind {1031 Whitespace,1032 MultiLineComment,1033 ErrorCommentTooShort,1034 ErrorCommentUnterminated,1035 SingleLineHashComment,1036 SingleLineSlashComment,1037}10381039#[derive(Debug, Clone, PartialEq, Eq, Hash)]1040pub struct CustomError {1041 syntax: SyntaxToken,1042 kind: CustomErrorKind,1043}10441045#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]1046pub enum CustomErrorKind {1047 ErrorMissingToken,1048 ErrorUnexpectedToken,1049 ErrorCustom,1050}1051impl AstNode for SourceFile {1052 fn can_cast(kind: SyntaxKind) -> bool {1053 kind == SOURCE_FILE1054 }1055 fn cast(syntax: SyntaxNode) -> Option<Self> {1056 if Self::can_cast(syntax.kind()) {1057 Some(Self { syntax })1058 } else {1059 None1060 }1061 }1062 fn syntax(&self) -> &SyntaxNode {1063 &self.syntax1064 }1065}1066impl AstNode for Expr {1067 fn can_cast(kind: SyntaxKind) -> bool {1068 kind == EXPR1069 }1070 fn cast(syntax: SyntaxNode) -> Option<Self> {1071 if Self::can_cast(syntax.kind()) {1072 Some(Self { syntax })1073 } else {1074 None1075 }1076 }1077 fn syntax(&self) -> &SyntaxNode {1078 &self.syntax1079 }1080}1081impl AstNode for ExprBinary {1082 fn can_cast(kind: SyntaxKind) -> bool {1083 kind == EXPR_BINARY1084 }1085 fn cast(syntax: SyntaxNode) -> Option<Self> {1086 if Self::can_cast(syntax.kind()) {1087 Some(Self { syntax })1088 } else {1089 None1090 }1091 }1092 fn syntax(&self) -> &SyntaxNode {1093 &self.syntax1094 }1095}1096impl AstNode for LhsExpr {1097 fn can_cast(kind: SyntaxKind) -> bool {1098 kind == LHS_EXPR1099 }1100 fn cast(syntax: SyntaxNode) -> Option<Self> {1101 if Self::can_cast(syntax.kind()) {1102 Some(Self { syntax })1103 } else {1104 None1105 }1106 }1107 fn syntax(&self) -> &SyntaxNode {1108 &self.syntax1109 }1110}1111impl AstNode for ExprUnary {1112 fn can_cast(kind: SyntaxKind) -> bool {1113 kind == EXPR_UNARY1114 }1115 fn cast(syntax: SyntaxNode) -> Option<Self> {1116 if Self::can_cast(syntax.kind()) {1117 Some(Self { syntax })1118 } else {1119 None1120 }1121 }1122 fn syntax(&self) -> &SyntaxNode {1123 &self.syntax1124 }1125}1126impl AstNode for ExprSlice {1127 fn can_cast(kind: SyntaxKind) -> bool {1128 kind == EXPR_SLICE1129 }1130 fn cast(syntax: SyntaxNode) -> Option<Self> {1131 if Self::can_cast(syntax.kind()) {1132 Some(Self { syntax })1133 } else {1134 None1135 }1136 }1137 fn syntax(&self) -> &SyntaxNode {1138 &self.syntax1139 }1140}1141impl AstNode for SliceDesc {1142 fn can_cast(kind: SyntaxKind) -> bool {1143 kind == SLICE_DESC1144 }1145 fn cast(syntax: SyntaxNode) -> Option<Self> {1146 if Self::can_cast(syntax.kind()) {1147 Some(Self { syntax })1148 } else {1149 None1150 }1151 }1152 fn syntax(&self) -> &SyntaxNode {1153 &self.syntax1154 }1155}1156impl AstNode for ExprIndex {1157 fn can_cast(kind: SyntaxKind) -> bool {1158 kind == EXPR_INDEX1159 }1160 fn cast(syntax: SyntaxNode) -> Option<Self> {1161 if Self::can_cast(syntax.kind()) {1162 Some(Self { syntax })1163 } else {1164 None1165 }1166 }1167 fn syntax(&self) -> &SyntaxNode {1168 &self.syntax1169 }1170}1171impl AstNode for Name {1172 fn can_cast(kind: SyntaxKind) -> bool {1173 kind == NAME1174 }1175 fn cast(syntax: SyntaxNode) -> Option<Self> {1176 if Self::can_cast(syntax.kind()) {1177 Some(Self { syntax })1178 } else {1179 None1180 }1181 }1182 fn syntax(&self) -> &SyntaxNode {1183 &self.syntax1184 }1185}1186impl AstNode for ExprIndexExpr {1187 fn can_cast(kind: SyntaxKind) -> bool {1188 kind == EXPR_INDEX_EXPR1189 }1190 fn cast(syntax: SyntaxNode) -> Option<Self> {1191 if Self::can_cast(syntax.kind()) {1192 Some(Self { syntax })1193 } else {1194 None1195 }1196 }1197 fn syntax(&self) -> &SyntaxNode {1198 &self.syntax1199 }1200}1201impl AstNode for ExprApply {1202 fn can_cast(kind: SyntaxKind) -> bool {1203 kind == EXPR_APPLY1204 }1205 fn cast(syntax: SyntaxNode) -> Option<Self> {1206 if Self::can_cast(syntax.kind()) {1207 Some(Self { syntax })1208 } else {1209 None1210 }1211 }1212 fn syntax(&self) -> &SyntaxNode {1213 &self.syntax1214 }1215}1216impl AstNode for ArgsDesc {1217 fn can_cast(kind: SyntaxKind) -> bool {1218 kind == ARGS_DESC1219 }1220 fn cast(syntax: SyntaxNode) -> Option<Self> {1221 if Self::can_cast(syntax.kind()) {1222 Some(Self { syntax })1223 } else {1224 None1225 }1226 }1227 fn syntax(&self) -> &SyntaxNode {1228 &self.syntax1229 }1230}1231impl AstNode for ExprObjExtend {1232 fn can_cast(kind: SyntaxKind) -> bool {1233 kind == EXPR_OBJ_EXTEND1234 }1235 fn cast(syntax: SyntaxNode) -> Option<Self> {1236 if Self::can_cast(syntax.kind()) {1237 Some(Self { syntax })1238 } else {1239 None1240 }1241 }1242 fn syntax(&self) -> &SyntaxNode {1243 &self.syntax1244 }1245}1246impl AstNode for ExprParened {1247 fn can_cast(kind: SyntaxKind) -> bool {1248 kind == EXPR_PARENED1249 }1250 fn cast(syntax: SyntaxNode) -> Option<Self> {1251 if Self::can_cast(syntax.kind()) {1252 Some(Self { syntax })1253 } else {1254 None1255 }1256 }1257 fn syntax(&self) -> &SyntaxNode {1258 &self.syntax1259 }1260}1261impl AstNode for ExprLiteral {1262 fn can_cast(kind: SyntaxKind) -> bool {1263 kind == EXPR_LITERAL1264 }1265 fn cast(syntax: SyntaxNode) -> Option<Self> {1266 if Self::can_cast(syntax.kind()) {1267 Some(Self { syntax })1268 } else {1269 None1270 }1271 }1272 fn syntax(&self) -> &SyntaxNode {1273 &self.syntax1274 }1275}1276impl AstNode for ExprString {1277 fn can_cast(kind: SyntaxKind) -> bool {1278 kind == EXPR_STRING1279 }1280 fn cast(syntax: SyntaxNode) -> Option<Self> {1281 if Self::can_cast(syntax.kind()) {1282 Some(Self { syntax })1283 } else {1284 None1285 }1286 }1287 fn syntax(&self) -> &SyntaxNode {1288 &self.syntax1289 }1290}1291impl AstNode for ExprNumber {1292 fn can_cast(kind: SyntaxKind) -> bool {1293 kind == EXPR_NUMBER1294 }1295 fn cast(syntax: SyntaxNode) -> Option<Self> {1296 if Self::can_cast(syntax.kind()) {1297 Some(Self { syntax })1298 } else {1299 None1300 }1301 }1302 fn syntax(&self) -> &SyntaxNode {1303 &self.syntax1304 }1305}1306impl AstNode for ExprArray {1307 fn can_cast(kind: SyntaxKind) -> bool {1308 kind == EXPR_ARRAY1309 }1310 fn cast(syntax: SyntaxNode) -> Option<Self> {1311 if Self::can_cast(syntax.kind()) {1312 Some(Self { syntax })1313 } else {1314 None1315 }1316 }1317 fn syntax(&self) -> &SyntaxNode {1318 &self.syntax1319 }1320}1321impl AstNode for ExprObject {1322 fn can_cast(kind: SyntaxKind) -> bool {1323 kind == EXPR_OBJECT1324 }1325 fn cast(syntax: SyntaxNode) -> Option<Self> {1326 if Self::can_cast(syntax.kind()) {1327 Some(Self { syntax })1328 } else {1329 None1330 }1331 }1332 fn syntax(&self) -> &SyntaxNode {1333 &self.syntax1334 }1335}1336impl AstNode for ExprArrayComp {1337 fn can_cast(kind: SyntaxKind) -> bool {1338 kind == EXPR_ARRAY_COMP1339 }1340 fn cast(syntax: SyntaxNode) -> Option<Self> {1341 if Self::can_cast(syntax.kind()) {1342 Some(Self { syntax })1343 } else {1344 None1345 }1346 }1347 fn syntax(&self) -> &SyntaxNode {1348 &self.syntax1349 }1350}1351impl AstNode for ExprImport {1352 fn can_cast(kind: SyntaxKind) -> bool {1353 kind == EXPR_IMPORT1354 }1355 fn cast(syntax: SyntaxNode) -> Option<Self> {1356 if Self::can_cast(syntax.kind()) {1357 Some(Self { syntax })1358 } else {1359 None1360 }1361 }1362 fn syntax(&self) -> &SyntaxNode {1363 &self.syntax1364 }1365}1366impl AstNode for ExprVar {1367 fn can_cast(kind: SyntaxKind) -> bool {1368 kind == EXPR_VAR1369 }1370 fn cast(syntax: SyntaxNode) -> Option<Self> {1371 if Self::can_cast(syntax.kind()) {1372 Some(Self { syntax })1373 } else {1374 None1375 }1376 }1377 fn syntax(&self) -> &SyntaxNode {1378 &self.syntax1379 }1380}1381impl AstNode for ExprIfThenElse {1382 fn can_cast(kind: SyntaxKind) -> bool {1383 kind == EXPR_IF_THEN_ELSE1384 }1385 fn cast(syntax: SyntaxNode) -> Option<Self> {1386 if Self::can_cast(syntax.kind()) {1387 Some(Self { syntax })1388 } else {1389 None1390 }1391 }1392 fn syntax(&self) -> &SyntaxNode {1393 &self.syntax1394 }1395}1396impl AstNode for TrueExpr {1397 fn can_cast(kind: SyntaxKind) -> bool {1398 kind == TRUE_EXPR1399 }1400 fn cast(syntax: SyntaxNode) -> Option<Self> {1401 if Self::can_cast(syntax.kind()) {1402 Some(Self { syntax })1403 } else {1404 None1405 }1406 }1407 fn syntax(&self) -> &SyntaxNode {1408 &self.syntax1409 }1410}1411impl AstNode for FalseExpr {1412 fn can_cast(kind: SyntaxKind) -> bool {1413 kind == FALSE_EXPR1414 }1415 fn cast(syntax: SyntaxNode) -> Option<Self> {1416 if Self::can_cast(syntax.kind()) {1417 Some(Self { syntax })1418 } else {1419 None1420 }1421 }1422 fn syntax(&self) -> &SyntaxNode {1423 &self.syntax1424 }1425}1426impl AstNode for ExprFunction {1427 fn can_cast(kind: SyntaxKind) -> bool {1428 kind == EXPR_FUNCTION1429 }1430 fn cast(syntax: SyntaxNode) -> Option<Self> {1431 if Self::can_cast(syntax.kind()) {1432 Some(Self { syntax })1433 } else {1434 None1435 }1436 }1437 fn syntax(&self) -> &SyntaxNode {1438 &self.syntax1439 }1440}1441impl AstNode for ParamsDesc {1442 fn can_cast(kind: SyntaxKind) -> bool {1443 kind == PARAMS_DESC1444 }1445 fn cast(syntax: SyntaxNode) -> Option<Self> {1446 if Self::can_cast(syntax.kind()) {1447 Some(Self { syntax })1448 } else {1449 None1450 }1451 }1452 fn syntax(&self) -> &SyntaxNode {1453 &self.syntax1454 }1455}1456impl AstNode for ExprAssert {1457 fn can_cast(kind: SyntaxKind) -> bool {1458 kind == EXPR_ASSERT1459 }1460 fn cast(syntax: SyntaxNode) -> Option<Self> {1461 if Self::can_cast(syntax.kind()) {1462 Some(Self { syntax })1463 } else {1464 None1465 }1466 }1467 fn syntax(&self) -> &SyntaxNode {1468 &self.syntax1469 }1470}1471impl AstNode for Assertion {1472 fn can_cast(kind: SyntaxKind) -> bool {1473 kind == ASSERTION1474 }1475 fn cast(syntax: SyntaxNode) -> Option<Self> {1476 if Self::can_cast(syntax.kind()) {1477 Some(Self { syntax })1478 } else {1479 None1480 }1481 }1482 fn syntax(&self) -> &SyntaxNode {1483 &self.syntax1484 }1485}1486impl AstNode for ExprError {1487 fn can_cast(kind: SyntaxKind) -> bool {1488 kind == EXPR_ERROR1489 }1490 fn cast(syntax: SyntaxNode) -> Option<Self> {1491 if Self::can_cast(syntax.kind()) {1492 Some(Self { syntax })1493 } else {1494 None1495 }1496 }1497 fn syntax(&self) -> &SyntaxNode {1498 &self.syntax1499 }1500}1501impl AstNode for StmtLocal {1502 fn can_cast(kind: SyntaxKind) -> bool {1503 kind == STMT_LOCAL1504 }1505 fn cast(syntax: SyntaxNode) -> Option<Self> {1506 if Self::can_cast(syntax.kind()) {1507 Some(Self { syntax })1508 } else {1509 None1510 }1511 }1512 fn syntax(&self) -> &SyntaxNode {1513 &self.syntax1514 }1515}1516impl AstNode for SliceDescEnd {1517 fn can_cast(kind: SyntaxKind) -> bool {1518 kind == SLICE_DESC_END1519 }1520 fn cast(syntax: SyntaxNode) -> Option<Self> {1521 if Self::can_cast(syntax.kind()) {1522 Some(Self { syntax })1523 } else {1524 None1525 }1526 }1527 fn syntax(&self) -> &SyntaxNode {1528 &self.syntax1529 }1530}1531impl AstNode for SliceDescStep {1532 fn can_cast(kind: SyntaxKind) -> bool {1533 kind == SLICE_DESC_STEP1534 }1535 fn cast(syntax: SyntaxNode) -> Option<Self> {1536 if Self::can_cast(syntax.kind()) {1537 Some(Self { syntax })1538 } else {1539 None1540 }1541 }1542 fn syntax(&self) -> &SyntaxNode {1543 &self.syntax1544 }1545}1546impl AstNode for Arg {1547 fn can_cast(kind: SyntaxKind) -> bool {1548 kind == ARG1549 }1550 fn cast(syntax: SyntaxNode) -> Option<Self> {1551 if Self::can_cast(syntax.kind()) {1552 Some(Self { syntax })1553 } else {1554 None1555 }1556 }1557 fn syntax(&self) -> &SyntaxNode {1558 &self.syntax1559 }1560}1561impl AstNode for ObjBodyComp {1562 fn can_cast(kind: SyntaxKind) -> bool {1563 kind == OBJ_BODY_COMP1564 }1565 fn cast(syntax: SyntaxNode) -> Option<Self> {1566 if Self::can_cast(syntax.kind()) {1567 Some(Self { syntax })1568 } else {1569 None1570 }1571 }1572 fn syntax(&self) -> &SyntaxNode {1573 &self.syntax1574 }1575}1576impl AstNode for ObjBodyMemberList {1577 fn can_cast(kind: SyntaxKind) -> bool {1578 kind == OBJ_BODY_MEMBER_LIST1579 }1580 fn cast(syntax: SyntaxNode) -> Option<Self> {1581 if Self::can_cast(syntax.kind()) {1582 Some(Self { syntax })1583 } else {1584 None1585 }1586 }1587 fn syntax(&self) -> &SyntaxNode {1588 &self.syntax1589 }1590}1591impl AstNode for MemberBindStmt {1592 fn can_cast(kind: SyntaxKind) -> bool {1593 kind == MEMBER_BIND_STMT1594 }1595 fn cast(syntax: SyntaxNode) -> Option<Self> {1596 if Self::can_cast(syntax.kind()) {1597 Some(Self { syntax })1598 } else {1599 None1600 }1601 }1602 fn syntax(&self) -> &SyntaxNode {1603 &self.syntax1604 }1605}1606impl AstNode for ObjLocal {1607 fn can_cast(kind: SyntaxKind) -> bool {1608 kind == OBJ_LOCAL1609 }1610 fn cast(syntax: SyntaxNode) -> Option<Self> {1611 if Self::can_cast(syntax.kind()) {1612 Some(Self { syntax })1613 } else {1614 None1615 }1616 }1617 fn syntax(&self) -> &SyntaxNode {1618 &self.syntax1619 }1620}1621impl AstNode for MemberAssertStmt {1622 fn can_cast(kind: SyntaxKind) -> bool {1623 kind == MEMBER_ASSERT_STMT1624 }1625 fn cast(syntax: SyntaxNode) -> Option<Self> {1626 if Self::can_cast(syntax.kind()) {1627 Some(Self { syntax })1628 } else {1629 None1630 }1631 }1632 fn syntax(&self) -> &SyntaxNode {1633 &self.syntax1634 }1635}1636impl AstNode for MemberFieldNormal {1637 fn can_cast(kind: SyntaxKind) -> bool {1638 kind == MEMBER_FIELD_NORMAL1639 }1640 fn cast(syntax: SyntaxNode) -> Option<Self> {1641 if Self::can_cast(syntax.kind()) {1642 Some(Self { syntax })1643 } else {1644 None1645 }1646 }1647 fn syntax(&self) -> &SyntaxNode {1648 &self.syntax1649 }1650}1651impl AstNode for MemberFieldMethod {1652 fn can_cast(kind: SyntaxKind) -> bool {1653 kind == MEMBER_FIELD_METHOD1654 }1655 fn cast(syntax: SyntaxNode) -> Option<Self> {1656 if Self::can_cast(syntax.kind()) {1657 Some(Self { syntax })1658 } else {1659 None1660 }1661 }1662 fn syntax(&self) -> &SyntaxNode {1663 &self.syntax1664 }1665}1666impl AstNode for FieldNameFixed {1667 fn can_cast(kind: SyntaxKind) -> bool {1668 kind == FIELD_NAME_FIXED1669 }1670 fn cast(syntax: SyntaxNode) -> Option<Self> {1671 if Self::can_cast(syntax.kind()) {1672 Some(Self { syntax })1673 } else {1674 None1675 }1676 }1677 fn syntax(&self) -> &SyntaxNode {1678 &self.syntax1679 }1680}1681impl AstNode for FieldNameDynamic {1682 fn can_cast(kind: SyntaxKind) -> bool {1683 kind == FIELD_NAME_DYNAMIC1684 }1685 fn cast(syntax: SyntaxNode) -> Option<Self> {1686 if Self::can_cast(syntax.kind()) {1687 Some(Self { syntax })1688 } else {1689 None1690 }1691 }1692 fn syntax(&self) -> &SyntaxNode {1693 &self.syntax1694 }1695}1696impl AstNode for ForSpec {1697 fn can_cast(kind: SyntaxKind) -> bool {1698 kind == FOR_SPEC1699 }1700 fn cast(syntax: SyntaxNode) -> Option<Self> {1701 if Self::can_cast(syntax.kind()) {1702 Some(Self { syntax })1703 } else {1704 None1705 }1706 }1707 fn syntax(&self) -> &SyntaxNode {1708 &self.syntax1709 }1710}1711impl AstNode for IfSpec {1712 fn can_cast(kind: SyntaxKind) -> bool {1713 kind == IF_SPEC1714 }1715 fn cast(syntax: SyntaxNode) -> Option<Self> {1716 if Self::can_cast(syntax.kind()) {1717 Some(Self { syntax })1718 } else {1719 None1720 }1721 }1722 fn syntax(&self) -> &SyntaxNode {1723 &self.syntax1724 }1725}1726impl AstNode for BindDestruct {1727 fn can_cast(kind: SyntaxKind) -> bool {1728 kind == BIND_DESTRUCT1729 }1730 fn cast(syntax: SyntaxNode) -> Option<Self> {1731 if Self::can_cast(syntax.kind()) {1732 Some(Self { syntax })1733 } else {1734 None1735 }1736 }1737 fn syntax(&self) -> &SyntaxNode {1738 &self.syntax1739 }1740}1741impl AstNode for BindFunction {1742 fn can_cast(kind: SyntaxKind) -> bool {1743 kind == BIND_FUNCTION1744 }1745 fn cast(syntax: SyntaxNode) -> Option<Self> {1746 if Self::can_cast(syntax.kind()) {1747 Some(Self { syntax })1748 } else {1749 None1750 }1751 }1752 fn syntax(&self) -> &SyntaxNode {1753 &self.syntax1754 }1755}1756impl AstNode for Param {1757 fn can_cast(kind: SyntaxKind) -> bool {1758 kind == PARAM1759 }1760 fn cast(syntax: SyntaxNode) -> Option<Self> {1761 if Self::can_cast(syntax.kind()) {1762 Some(Self { syntax })1763 } else {1764 None1765 }1766 }1767 fn syntax(&self) -> &SyntaxNode {1768 &self.syntax1769 }1770}1771impl AstNode for DestructFull {1772 fn can_cast(kind: SyntaxKind) -> bool {1773 kind == DESTRUCT_FULL1774 }1775 fn cast(syntax: SyntaxNode) -> Option<Self> {1776 if Self::can_cast(syntax.kind()) {1777 Some(Self { syntax })1778 } else {1779 None1780 }1781 }1782 fn syntax(&self) -> &SyntaxNode {1783 &self.syntax1784 }1785}1786impl AstNode for DestructSkip {1787 fn can_cast(kind: SyntaxKind) -> bool {1788 kind == DESTRUCT_SKIP1789 }1790 fn cast(syntax: SyntaxNode) -> Option<Self> {1791 if Self::can_cast(syntax.kind()) {1792 Some(Self { syntax })1793 } else {1794 None1795 }1796 }1797 fn syntax(&self) -> &SyntaxNode {1798 &self.syntax1799 }1800}1801impl AstNode for DestructArray {1802 fn can_cast(kind: SyntaxKind) -> bool {1803 kind == DESTRUCT_ARRAY1804 }1805 fn cast(syntax: SyntaxNode) -> Option<Self> {1806 if Self::can_cast(syntax.kind()) {1807 Some(Self { syntax })1808 } else {1809 None1810 }1811 }1812 fn syntax(&self) -> &SyntaxNode {1813 &self.syntax1814 }1815}1816impl AstNode for DestructObject {1817 fn can_cast(kind: SyntaxKind) -> bool {1818 kind == DESTRUCT_OBJECT1819 }1820 fn cast(syntax: SyntaxNode) -> Option<Self> {1821 if Self::can_cast(syntax.kind()) {1822 Some(Self { syntax })1823 } else {1824 None1825 }1826 }1827 fn syntax(&self) -> &SyntaxNode {1828 &self.syntax1829 }1830}1831impl AstNode for DestructObjectField {1832 fn can_cast(kind: SyntaxKind) -> bool {1833 kind == DESTRUCT_OBJECT_FIELD1834 }1835 fn cast(syntax: SyntaxNode) -> Option<Self> {1836 if Self::can_cast(syntax.kind()) {1837 Some(Self { syntax })1838 } else {1839 None1840 }1841 }1842 fn syntax(&self) -> &SyntaxNode {1843 &self.syntax1844 }1845}1846impl AstNode for DestructRest {1847 fn can_cast(kind: SyntaxKind) -> bool {1848 kind == DESTRUCT_REST1849 }1850 fn cast(syntax: SyntaxNode) -> Option<Self> {1851 if Self::can_cast(syntax.kind()) {1852 Some(Self { syntax })1853 } else {1854 None1855 }1856 }1857 fn syntax(&self) -> &SyntaxNode {1858 &self.syntax1859 }1860}1861impl AstNode for DestructArrayElement {1862 fn can_cast(kind: SyntaxKind) -> bool {1863 kind == DESTRUCT_ARRAY_ELEMENT1864 }1865 fn cast(syntax: SyntaxNode) -> Option<Self> {1866 if Self::can_cast(syntax.kind()) {1867 Some(Self { syntax })1868 } else {1869 None1870 }1871 }1872 fn syntax(&self) -> &SyntaxNode {1873 &self.syntax1874 }1875}1876impl From<ObjBodyComp> for ObjBody {1877 fn from(node: ObjBodyComp) -> ObjBody {1878 ObjBody::ObjBodyComp(node)1879 }1880}1881impl From<ObjBodyMemberList> for ObjBody {1882 fn from(node: ObjBodyMemberList) -> ObjBody {1883 ObjBody::ObjBodyMemberList(node)1884 }1885}1886impl AstNode for ObjBody {1887 fn can_cast(kind: SyntaxKind) -> bool {1888 match kind {1889 OBJ_BODY_COMP | OBJ_BODY_MEMBER_LIST => true,1890 _ => false,1891 }1892 }1893 fn cast(syntax: SyntaxNode) -> Option<Self> {1894 let res = match syntax.kind() {1895 OBJ_BODY_COMP => ObjBody::ObjBodyComp(ObjBodyComp { syntax }),1896 OBJ_BODY_MEMBER_LIST => ObjBody::ObjBodyMemberList(ObjBodyMemberList { syntax }),1897 _ => return None,1898 };1899 Some(res)1900 }1901 fn syntax(&self) -> &SyntaxNode {1902 match self {1903 ObjBody::ObjBodyComp(it) => &it.syntax,1904 ObjBody::ObjBodyMemberList(it) => &it.syntax,1905 }1906 }1907}1908impl From<ForSpec> for CompSpec {1909 fn from(node: ForSpec) -> CompSpec {1910 CompSpec::ForSpec(node)1911 }1912}1913impl From<IfSpec> for CompSpec {1914 fn from(node: IfSpec) -> CompSpec {1915 CompSpec::IfSpec(node)1916 }1917}1918impl AstNode for CompSpec {1919 fn can_cast(kind: SyntaxKind) -> bool {1920 match kind {1921 FOR_SPEC | IF_SPEC => true,1922 _ => false,1923 }1924 }1925 fn cast(syntax: SyntaxNode) -> Option<Self> {1926 let res = match syntax.kind() {1927 FOR_SPEC => CompSpec::ForSpec(ForSpec { syntax }),1928 IF_SPEC => CompSpec::IfSpec(IfSpec { syntax }),1929 _ => return None,1930 };1931 Some(res)1932 }1933 fn syntax(&self) -> &SyntaxNode {1934 match self {1935 CompSpec::ForSpec(it) => &it.syntax,1936 CompSpec::IfSpec(it) => &it.syntax,1937 }1938 }1939}1940impl From<BindDestruct> for Bind {1941 fn from(node: BindDestruct) -> Bind {1942 Bind::BindDestruct(node)1943 }1944}1945impl From<BindFunction> for Bind {1946 fn from(node: BindFunction) -> Bind {1947 Bind::BindFunction(node)1948 }1949}1950impl AstNode for Bind {1951 fn can_cast(kind: SyntaxKind) -> bool {1952 match kind {1953 BIND_DESTRUCT | BIND_FUNCTION => true,1954 _ => false,1955 }1956 }1957 fn cast(syntax: SyntaxNode) -> Option<Self> {1958 let res = match syntax.kind() {1959 BIND_DESTRUCT => Bind::BindDestruct(BindDestruct { syntax }),1960 BIND_FUNCTION => Bind::BindFunction(BindFunction { syntax }),1961 _ => return None,1962 };1963 Some(res)1964 }1965 fn syntax(&self) -> &SyntaxNode {1966 match self {1967 Bind::BindDestruct(it) => &it.syntax,1968 Bind::BindFunction(it) => &it.syntax,1969 }1970 }1971}1972impl From<ExprBinary> for ExprBase {1973 fn from(node: ExprBinary) -> ExprBase {1974 ExprBase::ExprBinary(node)1975 }1976}1977impl From<ExprUnary> for ExprBase {1978 fn from(node: ExprUnary) -> ExprBase {1979 ExprBase::ExprUnary(node)1980 }1981}1982impl From<ExprSlice> for ExprBase {1983 fn from(node: ExprSlice) -> ExprBase {1984 ExprBase::ExprSlice(node)1985 }1986}1987impl From<ExprIndex> for ExprBase {1988 fn from(node: ExprIndex) -> ExprBase {1989 ExprBase::ExprIndex(node)1990 }1991}1992impl From<ExprIndexExpr> for ExprBase {1993 fn from(node: ExprIndexExpr) -> ExprBase {1994 ExprBase::ExprIndexExpr(node)1995 }1996}1997impl From<ExprApply> for ExprBase {1998 fn from(node: ExprApply) -> ExprBase {1999 ExprBase::ExprApply(node)2000 }2001}2002impl From<ExprObjExtend> for ExprBase {2003 fn from(node: ExprObjExtend) -> ExprBase {2004 ExprBase::ExprObjExtend(node)2005 }2006}2007impl From<ExprParened> for ExprBase {2008 fn from(node: ExprParened) -> ExprBase {2009 ExprBase::ExprParened(node)2010 }2011}2012impl From<ExprString> for ExprBase {2013 fn from(node: ExprString) -> ExprBase {2014 ExprBase::ExprString(node)2015 }2016}2017impl From<ExprNumber> for ExprBase {2018 fn from(node: ExprNumber) -> ExprBase {2019 ExprBase::ExprNumber(node)2020 }2021}2022impl From<ExprLiteral> for ExprBase {2023 fn from(node: ExprLiteral) -> ExprBase {2024 ExprBase::ExprLiteral(node)2025 }2026}2027impl From<ExprArray> for ExprBase {2028 fn from(node: ExprArray) -> ExprBase {2029 ExprBase::ExprArray(node)2030 }2031}2032impl From<ExprObject> for ExprBase {2033 fn from(node: ExprObject) -> ExprBase {2034 ExprBase::ExprObject(node)2035 }2036}2037impl From<ExprArrayComp> for ExprBase {2038 fn from(node: ExprArrayComp) -> ExprBase {2039 ExprBase::ExprArrayComp(node)2040 }2041}2042impl From<ExprImport> for ExprBase {2043 fn from(node: ExprImport) -> ExprBase {2044 ExprBase::ExprImport(node)2045 }2046}2047impl From<ExprVar> for ExprBase {2048 fn from(node: ExprVar) -> ExprBase {2049 ExprBase::ExprVar(node)2050 }2051}2052impl From<ExprIfThenElse> for ExprBase {2053 fn from(node: ExprIfThenElse) -> ExprBase {2054 ExprBase::ExprIfThenElse(node)2055 }2056}2057impl From<ExprFunction> for ExprBase {2058 fn from(node: ExprFunction) -> ExprBase {2059 ExprBase::ExprFunction(node)2060 }2061}2062impl From<ExprAssert> for ExprBase {2063 fn from(node: ExprAssert) -> ExprBase {2064 ExprBase::ExprAssert(node)2065 }2066}2067impl From<ExprError> for ExprBase {2068 fn from(node: ExprError) -> ExprBase {2069 ExprBase::ExprError(node)2070 }2071}2072impl AstNode for ExprBase {2073 fn can_cast(kind: SyntaxKind) -> bool {2074 match kind {2075 EXPR_BINARY | EXPR_UNARY | EXPR_SLICE | EXPR_INDEX | EXPR_INDEX_EXPR | EXPR_APPLY2076 | EXPR_OBJ_EXTEND | EXPR_PARENED | EXPR_STRING | EXPR_NUMBER | EXPR_LITERAL2077 | EXPR_ARRAY | EXPR_OBJECT | EXPR_ARRAY_COMP | EXPR_IMPORT | EXPR_VAR2078 | EXPR_IF_THEN_ELSE | EXPR_FUNCTION | EXPR_ASSERT | EXPR_ERROR => true,2079 _ => false,2080 }2081 }2082 fn cast(syntax: SyntaxNode) -> Option<Self> {2083 let res = match syntax.kind() {2084 EXPR_BINARY => ExprBase::ExprBinary(ExprBinary { syntax }),2085 EXPR_UNARY => ExprBase::ExprUnary(ExprUnary { syntax }),2086 EXPR_SLICE => ExprBase::ExprSlice(ExprSlice { syntax }),2087 EXPR_INDEX => ExprBase::ExprIndex(ExprIndex { syntax }),2088 EXPR_INDEX_EXPR => ExprBase::ExprIndexExpr(ExprIndexExpr { syntax }),2089 EXPR_APPLY => ExprBase::ExprApply(ExprApply { syntax }),2090 EXPR_OBJ_EXTEND => ExprBase::ExprObjExtend(ExprObjExtend { syntax }),2091 EXPR_PARENED => ExprBase::ExprParened(ExprParened { syntax }),2092 EXPR_STRING => ExprBase::ExprString(ExprString { syntax }),2093 EXPR_NUMBER => ExprBase::ExprNumber(ExprNumber { syntax }),2094 EXPR_LITERAL => ExprBase::ExprLiteral(ExprLiteral { syntax }),2095 EXPR_ARRAY => ExprBase::ExprArray(ExprArray { syntax }),2096 EXPR_OBJECT => ExprBase::ExprObject(ExprObject { syntax }),2097 EXPR_ARRAY_COMP => ExprBase::ExprArrayComp(ExprArrayComp { syntax }),2098 EXPR_IMPORT => ExprBase::ExprImport(ExprImport { syntax }),2099 EXPR_VAR => ExprBase::ExprVar(ExprVar { syntax }),2100 EXPR_IF_THEN_ELSE => ExprBase::ExprIfThenElse(ExprIfThenElse { syntax }),2101 EXPR_FUNCTION => ExprBase::ExprFunction(ExprFunction { syntax }),2102 EXPR_ASSERT => ExprBase::ExprAssert(ExprAssert { syntax }),2103 EXPR_ERROR => ExprBase::ExprError(ExprError { syntax }),2104 _ => return None,2105 };2106 Some(res)2107 }2108 fn syntax(&self) -> &SyntaxNode {2109 match self {2110 ExprBase::ExprBinary(it) => &it.syntax,2111 ExprBase::ExprUnary(it) => &it.syntax,2112 ExprBase::ExprSlice(it) => &it.syntax,2113 ExprBase::ExprIndex(it) => &it.syntax,2114 ExprBase::ExprIndexExpr(it) => &it.syntax,2115 ExprBase::ExprApply(it) => &it.syntax,2116 ExprBase::ExprObjExtend(it) => &it.syntax,2117 ExprBase::ExprParened(it) => &it.syntax,2118 ExprBase::ExprString(it) => &it.syntax,2119 ExprBase::ExprNumber(it) => &it.syntax,2120 ExprBase::ExprLiteral(it) => &it.syntax,2121 ExprBase::ExprArray(it) => &it.syntax,2122 ExprBase::ExprObject(it) => &it.syntax,2123 ExprBase::ExprArrayComp(it) => &it.syntax,2124 ExprBase::ExprImport(it) => &it.syntax,2125 ExprBase::ExprVar(it) => &it.syntax,2126 ExprBase::ExprIfThenElse(it) => &it.syntax,2127 ExprBase::ExprFunction(it) => &it.syntax,2128 ExprBase::ExprAssert(it) => &it.syntax,2129 ExprBase::ExprError(it) => &it.syntax,2130 }2131 }2132}2133impl From<MemberBindStmt> for MemberComp {2134 fn from(node: MemberBindStmt) -> MemberComp {2135 MemberComp::MemberBindStmt(node)2136 }2137}2138impl From<MemberFieldNormal> for MemberComp {2139 fn from(node: MemberFieldNormal) -> MemberComp {2140 MemberComp::MemberFieldNormal(node)2141 }2142}2143impl From<MemberFieldMethod> for MemberComp {2144 fn from(node: MemberFieldMethod) -> MemberComp {2145 MemberComp::MemberFieldMethod(node)2146 }2147}2148impl AstNode for MemberComp {2149 fn can_cast(kind: SyntaxKind) -> bool {2150 match kind {2151 MEMBER_BIND_STMT | MEMBER_FIELD_NORMAL | MEMBER_FIELD_METHOD => true,2152 _ => false,2153 }2154 }2155 fn cast(syntax: SyntaxNode) -> Option<Self> {2156 let res = match syntax.kind() {2157 MEMBER_BIND_STMT => MemberComp::MemberBindStmt(MemberBindStmt { syntax }),2158 MEMBER_FIELD_NORMAL => MemberComp::MemberFieldNormal(MemberFieldNormal { syntax }),2159 MEMBER_FIELD_METHOD => MemberComp::MemberFieldMethod(MemberFieldMethod { syntax }),2160 _ => return None,2161 };2162 Some(res)2163 }2164 fn syntax(&self) -> &SyntaxNode {2165 match self {2166 MemberComp::MemberBindStmt(it) => &it.syntax,2167 MemberComp::MemberFieldNormal(it) => &it.syntax,2168 MemberComp::MemberFieldMethod(it) => &it.syntax,2169 }2170 }2171}2172impl From<MemberBindStmt> for Member {2173 fn from(node: MemberBindStmt) -> Member {2174 Member::MemberBindStmt(node)2175 }2176}2177impl From<MemberAssertStmt> for Member {2178 fn from(node: MemberAssertStmt) -> Member {2179 Member::MemberAssertStmt(node)2180 }2181}2182impl From<MemberFieldNormal> for Member {2183 fn from(node: MemberFieldNormal) -> Member {2184 Member::MemberFieldNormal(node)2185 }2186}2187impl From<MemberFieldMethod> for Member {2188 fn from(node: MemberFieldMethod) -> Member {2189 Member::MemberFieldMethod(node)2190 }2191}2192impl AstNode for Member {2193 fn can_cast(kind: SyntaxKind) -> bool {2194 match kind {2195 MEMBER_BIND_STMT | MEMBER_ASSERT_STMT | MEMBER_FIELD_NORMAL | MEMBER_FIELD_METHOD => {2196 true2197 }2198 _ => false,2199 }2200 }2201 fn cast(syntax: SyntaxNode) -> Option<Self> {2202 let res = match syntax.kind() {2203 MEMBER_BIND_STMT => Member::MemberBindStmt(MemberBindStmt { syntax }),2204 MEMBER_ASSERT_STMT => Member::MemberAssertStmt(MemberAssertStmt { syntax }),2205 MEMBER_FIELD_NORMAL => Member::MemberFieldNormal(MemberFieldNormal { syntax }),2206 MEMBER_FIELD_METHOD => Member::MemberFieldMethod(MemberFieldMethod { syntax }),2207 _ => return None,2208 };2209 Some(res)2210 }2211 fn syntax(&self) -> &SyntaxNode {2212 match self {2213 Member::MemberBindStmt(it) => &it.syntax,2214 Member::MemberAssertStmt(it) => &it.syntax,2215 Member::MemberFieldNormal(it) => &it.syntax,2216 Member::MemberFieldMethod(it) => &it.syntax,2217 }2218 }2219}2220impl From<FieldNameFixed> for FieldName {2221 fn from(node: FieldNameFixed) -> FieldName {2222 FieldName::FieldNameFixed(node)2223 }2224}2225impl From<FieldNameDynamic> for FieldName {2226 fn from(node: FieldNameDynamic) -> FieldName {2227 FieldName::FieldNameDynamic(node)2228 }2229}2230impl AstNode for FieldName {2231 fn can_cast(kind: SyntaxKind) -> bool {2232 match kind {2233 FIELD_NAME_FIXED | FIELD_NAME_DYNAMIC => true,2234 _ => false,2235 }2236 }2237 fn cast(syntax: SyntaxNode) -> Option<Self> {2238 let res = match syntax.kind() {2239 FIELD_NAME_FIXED => FieldName::FieldNameFixed(FieldNameFixed { syntax }),2240 FIELD_NAME_DYNAMIC => FieldName::FieldNameDynamic(FieldNameDynamic { syntax }),2241 _ => return None,2242 };2243 Some(res)2244 }2245 fn syntax(&self) -> &SyntaxNode {2246 match self {2247 FieldName::FieldNameFixed(it) => &it.syntax,2248 FieldName::FieldNameDynamic(it) => &it.syntax,2249 }2250 }2251}2252impl From<DestructFull> for Destruct {2253 fn from(node: DestructFull) -> Destruct {2254 Destruct::DestructFull(node)2255 }2256}2257impl From<DestructSkip> for Destruct {2258 fn from(node: DestructSkip) -> Destruct {2259 Destruct::DestructSkip(node)2260 }2261}2262impl From<DestructArray> for Destruct {2263 fn from(node: DestructArray) -> Destruct {2264 Destruct::DestructArray(node)2265 }2266}2267impl From<DestructObject> for Destruct {2268 fn from(node: DestructObject) -> Destruct {2269 Destruct::DestructObject(node)2270 }2271}2272impl AstNode for Destruct {2273 fn can_cast(kind: SyntaxKind) -> bool {2274 match kind {2275 DESTRUCT_FULL | DESTRUCT_SKIP | DESTRUCT_ARRAY | DESTRUCT_OBJECT => true,2276 _ => false,2277 }2278 }2279 fn cast(syntax: SyntaxNode) -> Option<Self> {2280 let res = match syntax.kind() {2281 DESTRUCT_FULL => Destruct::DestructFull(DestructFull { syntax }),2282 DESTRUCT_SKIP => Destruct::DestructSkip(DestructSkip { syntax }),2283 DESTRUCT_ARRAY => Destruct::DestructArray(DestructArray { syntax }),2284 DESTRUCT_OBJECT => Destruct::DestructObject(DestructObject { syntax }),2285 _ => return None,2286 };2287 Some(res)2288 }2289 fn syntax(&self) -> &SyntaxNode {2290 match self {2291 Destruct::DestructFull(it) => &it.syntax,2292 Destruct::DestructSkip(it) => &it.syntax,2293 Destruct::DestructArray(it) => &it.syntax,2294 Destruct::DestructObject(it) => &it.syntax,2295 }2296 }2297}2298impl From<DestructArrayElement> for DestructArrayPart {2299 fn from(node: DestructArrayElement) -> DestructArrayPart {2300 DestructArrayPart::DestructArrayElement(node)2301 }2302}2303impl From<DestructRest> for DestructArrayPart {2304 fn from(node: DestructRest) -> DestructArrayPart {2305 DestructArrayPart::DestructRest(node)2306 }2307}2308impl AstNode for DestructArrayPart {2309 fn can_cast(kind: SyntaxKind) -> bool {2310 match kind {2311 DESTRUCT_ARRAY_ELEMENT | DESTRUCT_REST => true,2312 _ => false,2313 }2314 }2315 fn cast(syntax: SyntaxNode) -> Option<Self> {2316 let res = match syntax.kind() {2317 DESTRUCT_ARRAY_ELEMENT => {2318 DestructArrayPart::DestructArrayElement(DestructArrayElement { syntax })2319 }2320 DESTRUCT_REST => DestructArrayPart::DestructRest(DestructRest { syntax }),2321 _ => return None,2322 };2323 Some(res)2324 }2325 fn syntax(&self) -> &SyntaxNode {2326 match self {2327 DestructArrayPart::DestructArrayElement(it) => &it.syntax,2328 DestructArrayPart::DestructRest(it) => &it.syntax,2329 }2330 }2331}2332impl AstToken for BinaryOperator {2333 fn can_cast(kind: SyntaxKind) -> bool {2334 BinaryOperatorKind::can_cast(kind)2335 }2336 fn cast(syntax: SyntaxToken) -> Option<Self> {2337 let kind = BinaryOperatorKind::cast(syntax.kind())?;2338 Some(BinaryOperator { syntax, kind })2339 }2340 fn syntax(&self) -> &SyntaxToken {2341 &self.syntax2342 }2343}2344impl BinaryOperatorKind {2345 fn can_cast(kind: SyntaxKind) -> bool {2346 match kind {2347 OR | AND | BIT_OR | BIT_XOR | BIT_AND | EQ | NE | LT | GT | LE | GE | IN_KW | LHS2348 | RHS | PLUS | MINUS | MUL | DIV | MODULO | META_OBJECT_APPLY | ERROR_NO_OPERATOR => true,2349 _ => false,2350 }2351 }2352 pub fn cast(kind: SyntaxKind) -> Option<Self> {2353 let res = match kind {2354 OR => Self::Or,2355 AND => Self::And,2356 BIT_OR => Self::BitOr,2357 BIT_XOR => Self::BitXor,2358 BIT_AND => Self::BitAnd,2359 EQ => Self::Eq,2360 NE => Self::Ne,2361 LT => Self::Lt,2362 GT => Self::Gt,2363 LE => Self::Le,2364 GE => Self::Ge,2365 IN_KW => Self::InKw,2366 LHS => Self::Lhs,2367 RHS => Self::Rhs,2368 PLUS => Self::Plus,2369 MINUS => Self::Minus,2370 MUL => Self::Mul,2371 DIV => Self::Div,2372 MODULO => Self::Modulo,2373 META_OBJECT_APPLY => Self::MetaObjectApply,2374 ERROR_NO_OPERATOR => Self::ErrorNoOperator,2375 _ => return None,2376 };2377 Some(res)2378 }2379}2380impl BinaryOperator {2381 pub fn kind(&self) -> BinaryOperatorKind {2382 self.kind2383 }2384}2385impl std::fmt::Display for BinaryOperator {2386 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2387 std::fmt::Display::fmt(self.syntax(), f)2388 }2389}2390impl AstToken for UnaryOperator {2391 fn can_cast(kind: SyntaxKind) -> bool {2392 UnaryOperatorKind::can_cast(kind)2393 }2394 fn cast(syntax: SyntaxToken) -> Option<Self> {2395 let kind = UnaryOperatorKind::cast(syntax.kind())?;2396 Some(UnaryOperator { syntax, kind })2397 }2398 fn syntax(&self) -> &SyntaxToken {2399 &self.syntax2400 }2401}2402impl UnaryOperatorKind {2403 fn can_cast(kind: SyntaxKind) -> bool {2404 match kind {2405 MINUS | NOT | BIT_NOT => true,2406 _ => false,2407 }2408 }2409 pub fn cast(kind: SyntaxKind) -> Option<Self> {2410 let res = match kind {2411 MINUS => Self::Minus,2412 NOT => Self::Not,2413 BIT_NOT => Self::BitNot,2414 _ => return None,2415 };2416 Some(res)2417 }2418}2419impl UnaryOperator {2420 pub fn kind(&self) -> UnaryOperatorKind {2421 self.kind2422 }2423}2424impl std::fmt::Display for UnaryOperator {2425 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2426 std::fmt::Display::fmt(self.syntax(), f)2427 }2428}2429impl AstToken for Literal {2430 fn can_cast(kind: SyntaxKind) -> bool {2431 LiteralKind::can_cast(kind)2432 }2433 fn cast(syntax: SyntaxToken) -> Option<Self> {2434 let kind = LiteralKind::cast(syntax.kind())?;2435 Some(Literal { syntax, kind })2436 }2437 fn syntax(&self) -> &SyntaxToken {2438 &self.syntax2439 }2440}2441impl LiteralKind {2442 fn can_cast(kind: SyntaxKind) -> bool {2443 match kind {2444 NULL_KW | TRUE_KW | FALSE_KW | SELF_KW | DOLLAR | SUPER_KW => true,2445 _ => false,2446 }2447 }2448 pub fn cast(kind: SyntaxKind) -> Option<Self> {2449 let res = match kind {2450 NULL_KW => Self::NullKw,2451 TRUE_KW => Self::TrueKw,2452 FALSE_KW => Self::FalseKw,2453 SELF_KW => Self::SelfKw,2454 DOLLAR => Self::Dollar,2455 SUPER_KW => Self::SuperKw,2456 _ => return None,2457 };2458 Some(res)2459 }2460}2461impl Literal {2462 pub fn kind(&self) -> LiteralKind {2463 self.kind2464 }2465}2466impl std::fmt::Display for Literal {2467 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2468 std::fmt::Display::fmt(self.syntax(), f)2469 }2470}2471impl AstToken for Text {2472 fn can_cast(kind: SyntaxKind) -> bool {2473 TextKind::can_cast(kind)2474 }2475 fn cast(syntax: SyntaxToken) -> Option<Self> {2476 let kind = TextKind::cast(syntax.kind())?;2477 Some(Text { syntax, kind })2478 }2479 fn syntax(&self) -> &SyntaxToken {2480 &self.syntax2481 }2482}2483impl TextKind {2484 fn can_cast(kind: SyntaxKind) -> bool {2485 match kind {2486 STRING_DOUBLE2487 | ERROR_STRING_DOUBLE_UNTERMINATED2488 | STRING_SINGLE2489 | ERROR_STRING_SINGLE_UNTERMINATED2490 | STRING_DOUBLE_VERBATIM2491 | ERROR_STRING_DOUBLE_VERBATIM_UNTERMINATED2492 | STRING_SINGLE_VERBATIM2493 | ERROR_STRING_SINGLE_VERBATIM_UNTERMINATED2494 | ERROR_STRING_VERBATIM_MISSING_QUOTES2495 | STRING_BLOCK2496 | ERROR_STRING_BLOCK_UNEXPECTED_END2497 | ERROR_STRING_BLOCK_MISSING_NEW_LINE2498 | ERROR_STRING_BLOCK_MISSING_TERMINATION2499 | ERROR_STRING_BLOCK_MISSING_INDENT => true,2500 _ => false,2501 }2502 }2503 pub fn cast(kind: SyntaxKind) -> Option<Self> {2504 let res = match kind {2505 STRING_DOUBLE => Self::StringDouble,2506 ERROR_STRING_DOUBLE_UNTERMINATED => Self::ErrorStringDoubleUnterminated,2507 STRING_SINGLE => Self::StringSingle,2508 ERROR_STRING_SINGLE_UNTERMINATED => Self::ErrorStringSingleUnterminated,2509 STRING_DOUBLE_VERBATIM => Self::StringDoubleVerbatim,2510 ERROR_STRING_DOUBLE_VERBATIM_UNTERMINATED => {2511 Self::ErrorStringDoubleVerbatimUnterminated2512 }2513 STRING_SINGLE_VERBATIM => Self::StringSingleVerbatim,2514 ERROR_STRING_SINGLE_VERBATIM_UNTERMINATED => {2515 Self::ErrorStringSingleVerbatimUnterminated2516 }2517 ERROR_STRING_VERBATIM_MISSING_QUOTES => Self::ErrorStringVerbatimMissingQuotes,2518 STRING_BLOCK => Self::StringBlock,2519 ERROR_STRING_BLOCK_UNEXPECTED_END => Self::ErrorStringBlockUnexpectedEnd,2520 ERROR_STRING_BLOCK_MISSING_NEW_LINE => Self::ErrorStringBlockMissingNewLine,2521 ERROR_STRING_BLOCK_MISSING_TERMINATION => Self::ErrorStringBlockMissingTermination,2522 ERROR_STRING_BLOCK_MISSING_INDENT => Self::ErrorStringBlockMissingIndent,2523 _ => return None,2524 };2525 Some(res)2526 }2527}2528impl Text {2529 pub fn kind(&self) -> TextKind {2530 self.kind2531 }2532}2533impl std::fmt::Display for Text {2534 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2535 std::fmt::Display::fmt(self.syntax(), f)2536 }2537}2538impl AstToken for Number {2539 fn can_cast(kind: SyntaxKind) -> bool {2540 NumberKind::can_cast(kind)2541 }2542 fn cast(syntax: SyntaxToken) -> Option<Self> {2543 let kind = NumberKind::cast(syntax.kind())?;2544 Some(Number { syntax, kind })2545 }2546 fn syntax(&self) -> &SyntaxToken {2547 &self.syntax2548 }2549}2550impl NumberKind {2551 fn can_cast(kind: SyntaxKind) -> bool {2552 match kind {2553 FLOAT2554 | ERROR_FLOAT_JUNK_AFTER_POINT2555 | ERROR_FLOAT_JUNK_AFTER_EXPONENT2556 | ERROR_FLOAT_JUNK_AFTER_EXPONENT_SIGN => true,2557 _ => false,2558 }2559 }2560 pub fn cast(kind: SyntaxKind) -> Option<Self> {2561 let res = match kind {2562 FLOAT => Self::Float,2563 ERROR_FLOAT_JUNK_AFTER_POINT => Self::ErrorFloatJunkAfterPoint,2564 ERROR_FLOAT_JUNK_AFTER_EXPONENT => Self::ErrorFloatJunkAfterExponent,2565 ERROR_FLOAT_JUNK_AFTER_EXPONENT_SIGN => Self::ErrorFloatJunkAfterExponentSign,2566 _ => return None,2567 };2568 Some(res)2569 }2570}2571impl Number {2572 pub fn kind(&self) -> NumberKind {2573 self.kind2574 }2575}2576impl std::fmt::Display for Number {2577 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2578 std::fmt::Display::fmt(self.syntax(), f)2579 }2580}2581impl AstToken for ImportKind {2582 fn can_cast(kind: SyntaxKind) -> bool {2583 ImportKindKind::can_cast(kind)2584 }2585 fn cast(syntax: SyntaxToken) -> Option<Self> {2586 let kind = ImportKindKind::cast(syntax.kind())?;2587 Some(ImportKind { syntax, kind })2588 }2589 fn syntax(&self) -> &SyntaxToken {2590 &self.syntax2591 }2592}2593impl ImportKindKind {2594 fn can_cast(kind: SyntaxKind) -> bool {2595 match kind {2596 IMPORTSTR_KW | IMPORTBIN_KW | IMPORT_KW => true,2597 _ => false,2598 }2599 }2600 pub fn cast(kind: SyntaxKind) -> Option<Self> {2601 let res = match kind {2602 IMPORTSTR_KW => Self::ImportstrKw,2603 IMPORTBIN_KW => Self::ImportbinKw,2604 IMPORT_KW => Self::ImportKw,2605 _ => return None,2606 };2607 Some(res)2608 }2609}2610impl ImportKind {2611 pub fn kind(&self) -> ImportKindKind {2612 self.kind2613 }2614}2615impl std::fmt::Display for ImportKind {2616 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2617 std::fmt::Display::fmt(self.syntax(), f)2618 }2619}2620impl AstToken for Visibility {2621 fn can_cast(kind: SyntaxKind) -> bool {2622 VisibilityKind::can_cast(kind)2623 }2624 fn cast(syntax: SyntaxToken) -> Option<Self> {2625 let kind = VisibilityKind::cast(syntax.kind())?;2626 Some(Visibility { syntax, kind })2627 }2628 fn syntax(&self) -> &SyntaxToken {2629 &self.syntax2630 }2631}2632impl VisibilityKind {2633 fn can_cast(kind: SyntaxKind) -> bool {2634 match kind {2635 COLONCOLONCOLON | COLONCOLON | COLON => true,2636 _ => false,2637 }2638 }2639 pub fn cast(kind: SyntaxKind) -> Option<Self> {2640 let res = match kind {2641 COLONCOLONCOLON => Self::Coloncoloncolon,2642 COLONCOLON => Self::Coloncolon,2643 COLON => Self::Colon,2644 _ => return None,2645 };2646 Some(res)2647 }2648}2649impl Visibility {2650 pub fn kind(&self) -> VisibilityKind {2651 self.kind2652 }2653}2654impl std::fmt::Display for Visibility {2655 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2656 std::fmt::Display::fmt(self.syntax(), f)2657 }2658}2659impl AstToken for Trivia {2660 fn can_cast(kind: SyntaxKind) -> bool {2661 TriviaKind::can_cast(kind)2662 }2663 fn cast(syntax: SyntaxToken) -> Option<Self> {2664 let kind = TriviaKind::cast(syntax.kind())?;2665 Some(Trivia { syntax, kind })2666 }2667 fn syntax(&self) -> &SyntaxToken {2668 &self.syntax2669 }2670}2671impl TriviaKind {2672 fn can_cast(kind: SyntaxKind) -> bool {2673 match kind {2674 WHITESPACE2675 | MULTI_LINE_COMMENT2676 | ERROR_COMMENT_TOO_SHORT2677 | ERROR_COMMENT_UNTERMINATED2678 | SINGLE_LINE_HASH_COMMENT2679 | SINGLE_LINE_SLASH_COMMENT => true,2680 _ => false,2681 }2682 }2683 pub fn cast(kind: SyntaxKind) -> Option<Self> {2684 let res = match kind {2685 WHITESPACE => Self::Whitespace,2686 MULTI_LINE_COMMENT => Self::MultiLineComment,2687 ERROR_COMMENT_TOO_SHORT => Self::ErrorCommentTooShort,2688 ERROR_COMMENT_UNTERMINATED => Self::ErrorCommentUnterminated,2689 SINGLE_LINE_HASH_COMMENT => Self::SingleLineHashComment,2690 SINGLE_LINE_SLASH_COMMENT => Self::SingleLineSlashComment,2691 _ => return None,2692 };2693 Some(res)2694 }2695}2696impl Trivia {2697 pub fn kind(&self) -> TriviaKind {2698 self.kind2699 }2700}2701impl std::fmt::Display for Trivia {2702 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2703 std::fmt::Display::fmt(self.syntax(), f)2704 }2705}2706impl AstToken for CustomError {2707 fn can_cast(kind: SyntaxKind) -> bool {2708 CustomErrorKind::can_cast(kind)2709 }2710 fn cast(syntax: SyntaxToken) -> Option<Self> {2711 let kind = CustomErrorKind::cast(syntax.kind())?;2712 Some(CustomError { syntax, kind })2713 }2714 fn syntax(&self) -> &SyntaxToken {2715 &self.syntax2716 }2717}2718impl CustomErrorKind {2719 fn can_cast(kind: SyntaxKind) -> bool {2720 match kind {2721 ERROR_MISSING_TOKEN | ERROR_UNEXPECTED_TOKEN | ERROR_CUSTOM => true,2722 _ => false,2723 }2724 }2725 pub fn cast(kind: SyntaxKind) -> Option<Self> {2726 let res = match kind {2727 ERROR_MISSING_TOKEN => Self::ErrorMissingToken,2728 ERROR_UNEXPECTED_TOKEN => Self::ErrorUnexpectedToken,2729 ERROR_CUSTOM => Self::ErrorCustom,2730 _ => return None,2731 };2732 Some(res)2733 }2734}2735impl CustomError {2736 pub fn kind(&self) -> CustomErrorKind {2737 self.kind2738 }2739}2740impl std::fmt::Display for CustomError {2741 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2742 std::fmt::Display::fmt(self.syntax(), f)2743 }2744}2745impl std::fmt::Display for ObjBody {2746 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2747 std::fmt::Display::fmt(self.syntax(), f)2748 }2749}2750impl std::fmt::Display for CompSpec {2751 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2752 std::fmt::Display::fmt(self.syntax(), f)2753 }2754}2755impl std::fmt::Display for Bind {2756 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2757 std::fmt::Display::fmt(self.syntax(), f)2758 }2759}2760impl std::fmt::Display for ExprBase {2761 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2762 std::fmt::Display::fmt(self.syntax(), f)2763 }2764}2765impl std::fmt::Display for MemberComp {2766 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2767 std::fmt::Display::fmt(self.syntax(), f)2768 }2769}2770impl std::fmt::Display for Member {2771 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2772 std::fmt::Display::fmt(self.syntax(), f)2773 }2774}2775impl std::fmt::Display for FieldName {2776 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2777 std::fmt::Display::fmt(self.syntax(), f)2778 }2779}2780impl std::fmt::Display for Destruct {2781 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2782 std::fmt::Display::fmt(self.syntax(), f)2783 }2784}2785impl std::fmt::Display for DestructArrayPart {2786 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2787 std::fmt::Display::fmt(self.syntax(), f)2788 }2789}2790impl std::fmt::Display for SourceFile {2791 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2792 std::fmt::Display::fmt(self.syntax(), f)2793 }2794}2795impl std::fmt::Display for Expr {2796 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2797 std::fmt::Display::fmt(self.syntax(), f)2798 }2799}2800impl std::fmt::Display for ExprBinary {2801 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2802 std::fmt::Display::fmt(self.syntax(), f)2803 }2804}2805impl std::fmt::Display for LhsExpr {2806 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2807 std::fmt::Display::fmt(self.syntax(), f)2808 }2809}2810impl std::fmt::Display for ExprUnary {2811 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2812 std::fmt::Display::fmt(self.syntax(), f)2813 }2814}2815impl std::fmt::Display for ExprSlice {2816 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2817 std::fmt::Display::fmt(self.syntax(), f)2818 }2819}2820impl std::fmt::Display for SliceDesc {2821 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2822 std::fmt::Display::fmt(self.syntax(), f)2823 }2824}2825impl std::fmt::Display for ExprIndex {2826 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2827 std::fmt::Display::fmt(self.syntax(), f)2828 }2829}2830impl std::fmt::Display for Name {2831 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2832 std::fmt::Display::fmt(self.syntax(), f)2833 }2834}2835impl std::fmt::Display for ExprIndexExpr {2836 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2837 std::fmt::Display::fmt(self.syntax(), f)2838 }2839}2840impl std::fmt::Display for ExprApply {2841 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2842 std::fmt::Display::fmt(self.syntax(), f)2843 }2844}2845impl std::fmt::Display for ArgsDesc {2846 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2847 std::fmt::Display::fmt(self.syntax(), f)2848 }2849}2850impl std::fmt::Display for ExprObjExtend {2851 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2852 std::fmt::Display::fmt(self.syntax(), f)2853 }2854}2855impl std::fmt::Display for ExprParened {2856 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2857 std::fmt::Display::fmt(self.syntax(), f)2858 }2859}2860impl std::fmt::Display for ExprLiteral {2861 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2862 std::fmt::Display::fmt(self.syntax(), f)2863 }2864}2865impl std::fmt::Display for ExprString {2866 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2867 std::fmt::Display::fmt(self.syntax(), f)2868 }2869}2870impl std::fmt::Display for ExprNumber {2871 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2872 std::fmt::Display::fmt(self.syntax(), f)2873 }2874}2875impl std::fmt::Display for ExprArray {2876 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2877 std::fmt::Display::fmt(self.syntax(), f)2878 }2879}2880impl std::fmt::Display for ExprObject {2881 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2882 std::fmt::Display::fmt(self.syntax(), f)2883 }2884}2885impl std::fmt::Display for ExprArrayComp {2886 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2887 std::fmt::Display::fmt(self.syntax(), f)2888 }2889}2890impl std::fmt::Display for ExprImport {2891 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2892 std::fmt::Display::fmt(self.syntax(), f)2893 }2894}2895impl std::fmt::Display for ExprVar {2896 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2897 std::fmt::Display::fmt(self.syntax(), f)2898 }2899}2900impl std::fmt::Display for ExprIfThenElse {2901 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2902 std::fmt::Display::fmt(self.syntax(), f)2903 }2904}2905impl std::fmt::Display for TrueExpr {2906 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2907 std::fmt::Display::fmt(self.syntax(), f)2908 }2909}2910impl std::fmt::Display for FalseExpr {2911 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2912 std::fmt::Display::fmt(self.syntax(), f)2913 }2914}2915impl std::fmt::Display for ExprFunction {2916 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2917 std::fmt::Display::fmt(self.syntax(), f)2918 }2919}2920impl std::fmt::Display for ParamsDesc {2921 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2922 std::fmt::Display::fmt(self.syntax(), f)2923 }2924}2925impl std::fmt::Display for ExprAssert {2926 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2927 std::fmt::Display::fmt(self.syntax(), f)2928 }2929}2930impl std::fmt::Display for Assertion {2931 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2932 std::fmt::Display::fmt(self.syntax(), f)2933 }2934}2935impl std::fmt::Display for ExprError {2936 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2937 std::fmt::Display::fmt(self.syntax(), f)2938 }2939}2940impl std::fmt::Display for StmtLocal {2941 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2942 std::fmt::Display::fmt(self.syntax(), f)2943 }2944}2945impl std::fmt::Display for SliceDescEnd {2946 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2947 std::fmt::Display::fmt(self.syntax(), f)2948 }2949}2950impl std::fmt::Display for SliceDescStep {2951 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2952 std::fmt::Display::fmt(self.syntax(), f)2953 }2954}2955impl std::fmt::Display for Arg {2956 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2957 std::fmt::Display::fmt(self.syntax(), f)2958 }2959}2960impl std::fmt::Display for ObjBodyComp {2961 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2962 std::fmt::Display::fmt(self.syntax(), f)2963 }2964}2965impl std::fmt::Display for ObjBodyMemberList {2966 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2967 std::fmt::Display::fmt(self.syntax(), f)2968 }2969}2970impl std::fmt::Display for MemberBindStmt {2971 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2972 std::fmt::Display::fmt(self.syntax(), f)2973 }2974}2975impl std::fmt::Display for ObjLocal {2976 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2977 std::fmt::Display::fmt(self.syntax(), f)2978 }2979}2980impl std::fmt::Display for MemberAssertStmt {2981 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2982 std::fmt::Display::fmt(self.syntax(), f)2983 }2984}2985impl std::fmt::Display for MemberFieldNormal {2986 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2987 std::fmt::Display::fmt(self.syntax(), f)2988 }2989}2990impl std::fmt::Display for MemberFieldMethod {2991 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2992 std::fmt::Display::fmt(self.syntax(), f)2993 }2994}2995impl std::fmt::Display for FieldNameFixed {2996 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2997 std::fmt::Display::fmt(self.syntax(), f)2998 }2999}3000impl std::fmt::Display for FieldNameDynamic {3001 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3002 std::fmt::Display::fmt(self.syntax(), f)3003 }3004}3005impl std::fmt::Display for ForSpec {3006 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3007 std::fmt::Display::fmt(self.syntax(), f)3008 }3009}3010impl std::fmt::Display for IfSpec {3011 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3012 std::fmt::Display::fmt(self.syntax(), f)3013 }3014}3015impl std::fmt::Display for BindDestruct {3016 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3017 std::fmt::Display::fmt(self.syntax(), f)3018 }3019}3020impl std::fmt::Display for BindFunction {3021 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3022 std::fmt::Display::fmt(self.syntax(), f)3023 }3024}3025impl std::fmt::Display for Param {3026 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3027 std::fmt::Display::fmt(self.syntax(), f)3028 }3029}3030impl std::fmt::Display for DestructFull {3031 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3032 std::fmt::Display::fmt(self.syntax(), f)3033 }3034}3035impl std::fmt::Display for DestructSkip {3036 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3037 std::fmt::Display::fmt(self.syntax(), f)3038 }3039}3040impl std::fmt::Display for DestructArray {3041 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3042 std::fmt::Display::fmt(self.syntax(), f)3043 }3044}3045impl std::fmt::Display for DestructObject {3046 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3047 std::fmt::Display::fmt(self.syntax(), f)3048 }3049}3050impl std::fmt::Display for DestructObjectField {3051 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3052 std::fmt::Display::fmt(self.syntax(), f)3053 }3054}3055impl std::fmt::Display for DestructRest {3056 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3057 std::fmt::Display::fmt(self.syntax(), f)3058 }3059}3060impl std::fmt::Display for DestructArrayElement {3061 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3062 std::fmt::Display::fmt(self.syntax(), f)3063 }3064}