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 ExprBinary {23 pub(crate) syntax: SyntaxNode,24}25impl ExprBinary {26 pub fn lhs(&self) -> Option<LhsExpr> {27 support::child(&self.syntax)28 }29 pub fn binary_operator(&self) -> Option<BinaryOperator> {30 support::token_child(&self.syntax)31 }32 pub fn rhs(&self) -> Option<Expr> {33 support::child(&self.syntax)34 }35}3637#[derive(Debug, Clone, PartialEq, Eq, Hash)]38pub struct LhsExpr {39 pub(crate) syntax: SyntaxNode,40}41impl LhsExpr {42 pub fn expr(&self) -> Option<Expr> {43 support::child(&self.syntax)44 }45}4647#[derive(Debug, Clone, PartialEq, Eq, Hash)]48pub struct ExprUnary {49 pub(crate) syntax: SyntaxNode,50}51impl ExprUnary {52 pub fn unary_operator(&self) -> Option<UnaryOperator> {53 support::token_child(&self.syntax)54 }55 pub fn rhs(&self) -> Option<Expr> {56 support::child(&self.syntax)57 }58}5960#[derive(Debug, Clone, PartialEq, Eq, Hash)]61pub struct ExprSlice {62 pub(crate) syntax: SyntaxNode,63}64impl ExprSlice {65 pub fn expr(&self) -> Option<Expr> {66 support::child(&self.syntax)67 }68 pub fn slice_desc(&self) -> Option<SliceDesc> {69 support::child(&self.syntax)70 }71}7273#[derive(Debug, Clone, PartialEq, Eq, Hash)]74pub struct SliceDesc {75 pub(crate) syntax: SyntaxNode,76}77impl SliceDesc {78 pub fn l_brack_token(&self) -> Option<SyntaxToken> {79 support::token(&self.syntax, T!['['])80 }81 pub fn from(&self) -> Option<Expr> {82 support::child(&self.syntax)83 }84 pub fn colon_token(&self) -> Option<SyntaxToken> {85 support::token(&self.syntax, T![:])86 }87 pub fn end(&self) -> Option<SliceDescEnd> {88 support::child(&self.syntax)89 }90 pub fn step(&self) -> Option<SliceDescStep> {91 support::child(&self.syntax)92 }93 pub fn r_brack_token(&self) -> Option<SyntaxToken> {94 support::token(&self.syntax, T![']'])95 }96}9798#[derive(Debug, Clone, PartialEq, Eq, Hash)]99pub struct ExprIndex {100 pub(crate) syntax: SyntaxNode,101}102impl ExprIndex {103 pub fn expr(&self) -> Option<Expr> {104 support::child(&self.syntax)105 }106 pub fn dot_token(&self) -> Option<SyntaxToken> {107 support::token(&self.syntax, T![.])108 }109 pub fn index(&self) -> Option<Name> {110 support::child(&self.syntax)111 }112}113114#[derive(Debug, Clone, PartialEq, Eq, Hash)]115pub struct Name {116 pub(crate) syntax: SyntaxNode,117}118impl Name {119 pub fn ident_lit(&self) -> Option<SyntaxToken> {120 support::token(&self.syntax, IDENT)121 }122}123124#[derive(Debug, Clone, PartialEq, Eq, Hash)]125pub struct ExprIndexExpr {126 pub(crate) syntax: SyntaxNode,127}128impl ExprIndexExpr {129 pub fn base(&self) -> Option<LhsExpr> {130 support::child(&self.syntax)131 }132 pub fn l_brack_token(&self) -> Option<SyntaxToken> {133 support::token(&self.syntax, T!['['])134 }135 pub fn index(&self) -> Option<Expr> {136 support::child(&self.syntax)137 }138 pub fn r_brack_token(&self) -> Option<SyntaxToken> {139 support::token(&self.syntax, T![']'])140 }141}142143#[derive(Debug, Clone, PartialEq, Eq, Hash)]144pub struct ExprApply {145 pub(crate) syntax: SyntaxNode,146}147impl ExprApply {148 pub fn expr(&self) -> Option<Expr> {149 support::child(&self.syntax)150 }151 pub fn args_desc(&self) -> Option<ArgsDesc> {152 support::child(&self.syntax)153 }154 pub fn tailstrict_kw_token(&self) -> Option<SyntaxToken> {155 support::token(&self.syntax, T![tailstrict])156 }157}158159#[derive(Debug, Clone, PartialEq, Eq, Hash)]160pub struct ArgsDesc {161 pub(crate) syntax: SyntaxNode,162}163impl ArgsDesc {164 pub fn l_paren_token(&self) -> Option<SyntaxToken> {165 support::token(&self.syntax, T!['('])166 }167 pub fn args(&self) -> AstChildren<Arg> {168 support::children(&self.syntax)169 }170 pub fn r_paren_token(&self) -> Option<SyntaxToken> {171 support::token(&self.syntax, T![')'])172 }173}174175#[derive(Debug, Clone, PartialEq, Eq, Hash)]176pub struct ExprObjExtend {177 pub(crate) syntax: SyntaxNode,178}179impl ExprObjExtend {180 pub fn lhs_expr(&self) -> Option<LhsExpr> {181 support::child(&self.syntax)182 }183 pub fn expr(&self) -> Option<Expr> {184 support::child(&self.syntax)185 }186}187188#[derive(Debug, Clone, PartialEq, Eq, Hash)]189pub struct ExprParened {190 pub(crate) syntax: SyntaxNode,191}192impl ExprParened {193 pub fn l_paren_token(&self) -> Option<SyntaxToken> {194 support::token(&self.syntax, T!['('])195 }196 pub fn expr(&self) -> Option<Expr> {197 support::child(&self.syntax)198 }199 pub fn r_paren_token(&self) -> Option<SyntaxToken> {200 support::token(&self.syntax, T![')'])201 }202}203204#[derive(Debug, Clone, PartialEq, Eq, Hash)]205pub struct ExprLiteral {206 pub(crate) syntax: SyntaxNode,207}208impl ExprLiteral {209 pub fn literal(&self) -> Option<Literal> {210 support::token_child(&self.syntax)211 }212}213214#[derive(Debug, Clone, PartialEq, Eq, Hash)]215pub struct ExprIntrinsicThisFile {216 pub(crate) syntax: SyntaxNode,217}218impl ExprIntrinsicThisFile {219 pub fn intrinsic_this_file_token(&self) -> Option<SyntaxToken> {220 support::token(&self.syntax, T!["$intrinsicThisFile"])221 }222}223224#[derive(Debug, Clone, PartialEq, Eq, Hash)]225pub struct ExprIntrinsicId {226 pub(crate) syntax: SyntaxNode,227}228impl ExprIntrinsicId {229 pub fn intrinsic_id_token(&self) -> Option<SyntaxToken> {230 support::token(&self.syntax, T!["$intrinsicId"])231 }232}233234#[derive(Debug, Clone, PartialEq, Eq, Hash)]235pub struct ExprIntrinsic {236 pub(crate) syntax: SyntaxNode,237}238impl ExprIntrinsic {239 pub fn intrinsic_token(&self) -> Option<SyntaxToken> {240 support::token(&self.syntax, T!["$intrinsic"])241 }242 pub fn l_paren_token(&self) -> Option<SyntaxToken> {243 support::token(&self.syntax, T!['('])244 }245 pub fn name(&self) -> Option<Name> {246 support::child(&self.syntax)247 }248 pub fn r_paren_token(&self) -> Option<SyntaxToken> {249 support::token(&self.syntax, T![')'])250 }251}252253#[derive(Debug, Clone, PartialEq, Eq, Hash)]254pub struct ExprString {255 pub(crate) syntax: SyntaxNode,256}257impl ExprString {258 pub fn text(&self) -> Option<Text> {259 support::token_child(&self.syntax)260 }261}262263#[derive(Debug, Clone, PartialEq, Eq, Hash)]264pub struct ExprNumber {265 pub(crate) syntax: SyntaxNode,266}267impl ExprNumber {268 pub fn number(&self) -> Option<Number> {269 support::token_child(&self.syntax)270 }271}272273#[derive(Debug, Clone, PartialEq, Eq, Hash)]274pub struct ExprArray {275 pub(crate) syntax: SyntaxNode,276}277impl ExprArray {278 pub fn l_brack_token(&self) -> Option<SyntaxToken> {279 support::token(&self.syntax, T!['['])280 }281 pub fn exprs(&self) -> AstChildren<Expr> {282 support::children(&self.syntax)283 }284 pub fn r_brack_token(&self) -> Option<SyntaxToken> {285 support::token(&self.syntax, T![']'])286 }287}288289#[derive(Debug, Clone, PartialEq, Eq, Hash)]290pub struct ExprObject {291 pub(crate) syntax: SyntaxNode,292}293impl ExprObject {294 pub fn l_brace_token(&self) -> Option<SyntaxToken> {295 support::token(&self.syntax, T!['{'])296 }297 pub fn obj_body(&self) -> Option<ObjBody> {298 support::child(&self.syntax)299 }300 pub fn r_brace_token(&self) -> Option<SyntaxToken> {301 support::token(&self.syntax, T!['}'])302 }303}304305#[derive(Debug, Clone, PartialEq, Eq, Hash)]306pub struct ExprArrayComp {307 pub(crate) syntax: SyntaxNode,308}309impl ExprArrayComp {310 pub fn l_brack_token(&self) -> Option<SyntaxToken> {311 support::token(&self.syntax, T!['['])312 }313 pub fn expr(&self) -> Option<Expr> {314 support::child(&self.syntax)315 }316 pub fn comma_token(&self) -> Option<SyntaxToken> {317 support::token(&self.syntax, T![,])318 }319 pub fn comp_specs(&self) -> AstChildren<CompSpec> {320 support::children(&self.syntax)321 }322 pub fn r_brack_token(&self) -> Option<SyntaxToken> {323 support::token(&self.syntax, T![']'])324 }325}326327#[derive(Debug, Clone, PartialEq, Eq, Hash)]328pub struct ExprImport {329 pub(crate) syntax: SyntaxNode,330}331impl ExprImport {332 pub fn import_kind(&self) -> Option<ImportKind> {333 support::token_child(&self.syntax)334 }335 pub fn text(&self) -> Option<Text> {336 support::token_child(&self.syntax)337 }338}339340#[derive(Debug, Clone, PartialEq, Eq, Hash)]341pub struct ExprVar {342 pub(crate) syntax: SyntaxNode,343}344impl ExprVar {345 pub fn name(&self) -> Option<Name> {346 support::child(&self.syntax)347 }348}349350#[derive(Debug, Clone, PartialEq, Eq, Hash)]351pub struct ExprLocal {352 pub(crate) syntax: SyntaxNode,353}354impl ExprLocal {355 pub fn local_kw_token(&self) -> Option<SyntaxToken> {356 support::token(&self.syntax, T![local])357 }358 pub fn binds(&self) -> AstChildren<Bind> {359 support::children(&self.syntax)360 }361 pub fn semi_token(&self) -> Option<SyntaxToken> {362 support::token(&self.syntax, T![;])363 }364 pub fn expr(&self) -> Option<Expr> {365 support::child(&self.syntax)366 }367}368369#[derive(Debug, Clone, PartialEq, Eq, Hash)]370pub struct ExprIfThenElse {371 pub(crate) syntax: SyntaxNode,372}373impl ExprIfThenElse {374 pub fn if_kw_token(&self) -> Option<SyntaxToken> {375 support::token(&self.syntax, T![if])376 }377 pub fn cond(&self) -> Option<Expr> {378 support::child(&self.syntax)379 }380 pub fn then_kw_token(&self) -> Option<SyntaxToken> {381 support::token(&self.syntax, T![then])382 }383 pub fn then(&self) -> Option<TrueExpr> {384 support::child(&self.syntax)385 }386 pub fn else_kw_token(&self) -> Option<SyntaxToken> {387 support::token(&self.syntax, T![else])388 }389 pub fn else_(&self) -> Option<FalseExpr> {390 support::child(&self.syntax)391 }392}393394#[derive(Debug, Clone, PartialEq, Eq, Hash)]395pub struct TrueExpr {396 pub(crate) syntax: SyntaxNode,397}398impl TrueExpr {399 pub fn expr(&self) -> Option<Expr> {400 support::child(&self.syntax)401 }402}403404#[derive(Debug, Clone, PartialEq, Eq, Hash)]405pub struct FalseExpr {406 pub(crate) syntax: SyntaxNode,407}408impl FalseExpr {409 pub fn expr(&self) -> Option<Expr> {410 support::child(&self.syntax)411 }412}413414#[derive(Debug, Clone, PartialEq, Eq, Hash)]415pub struct ExprFunction {416 pub(crate) syntax: SyntaxNode,417}418impl ExprFunction {419 pub fn function_kw_token(&self) -> Option<SyntaxToken> {420 support::token(&self.syntax, T![function])421 }422 pub fn l_paren_token(&self) -> Option<SyntaxToken> {423 support::token(&self.syntax, T!['('])424 }425 pub fn params_desc(&self) -> Option<ParamsDesc> {426 support::child(&self.syntax)427 }428 pub fn r_paren_token(&self) -> Option<SyntaxToken> {429 support::token(&self.syntax, T![')'])430 }431 pub fn expr(&self) -> Option<Expr> {432 support::child(&self.syntax)433 }434}435436#[derive(Debug, Clone, PartialEq, Eq, Hash)]437pub struct ParamsDesc {438 pub(crate) syntax: SyntaxNode,439}440impl ParamsDesc {441 pub fn l_paren_token(&self) -> Option<SyntaxToken> {442 support::token(&self.syntax, T!['('])443 }444 pub fn params(&self) -> AstChildren<Param> {445 support::children(&self.syntax)446 }447 pub fn r_paren_token(&self) -> Option<SyntaxToken> {448 support::token(&self.syntax, T![')'])449 }450}451452#[derive(Debug, Clone, PartialEq, Eq, Hash)]453pub struct ExprAssert {454 pub(crate) syntax: SyntaxNode,455}456impl ExprAssert {457 pub fn assertion(&self) -> Option<Assertion> {458 support::child(&self.syntax)459 }460 pub fn semi_token(&self) -> Option<SyntaxToken> {461 support::token(&self.syntax, T![;])462 }463 pub fn expr(&self) -> Option<Expr> {464 support::child(&self.syntax)465 }466}467468#[derive(Debug, Clone, PartialEq, Eq, Hash)]469pub struct Assertion {470 pub(crate) syntax: SyntaxNode,471}472impl Assertion {473 pub fn assert_kw_token(&self) -> Option<SyntaxToken> {474 support::token(&self.syntax, T![assert])475 }476 pub fn condition(&self) -> Option<LhsExpr> {477 support::child(&self.syntax)478 }479 pub fn colon_token(&self) -> Option<SyntaxToken> {480 support::token(&self.syntax, T![:])481 }482 pub fn message(&self) -> Option<Expr> {483 support::child(&self.syntax)484 }485}486487#[derive(Debug, Clone, PartialEq, Eq, Hash)]488pub struct ExprError {489 pub(crate) syntax: SyntaxNode,490}491impl ExprError {492 pub fn error_kw_token(&self) -> Option<SyntaxToken> {493 support::token(&self.syntax, T![error])494 }495 pub fn expr(&self) -> Option<Expr> {496 support::child(&self.syntax)497 }498}499500#[derive(Debug, Clone, PartialEq, Eq, Hash)]501pub struct SliceDescEnd {502 pub(crate) syntax: SyntaxNode,503}504impl SliceDescEnd {505 pub fn expr(&self) -> Option<Expr> {506 support::child(&self.syntax)507 }508}509510#[derive(Debug, Clone, PartialEq, Eq, Hash)]511pub struct SliceDescStep {512 pub(crate) syntax: SyntaxNode,513}514impl SliceDescStep {515 pub fn expr(&self) -> Option<Expr> {516 support::child(&self.syntax)517 }518}519520#[derive(Debug, Clone, PartialEq, Eq, Hash)]521pub struct Arg {522 pub(crate) syntax: SyntaxNode,523}524impl Arg {525 pub fn name(&self) -> Option<Name> {526 support::child(&self.syntax)527 }528 pub fn assign_token(&self) -> Option<SyntaxToken> {529 support::token(&self.syntax, T![=])530 }531 pub fn expr(&self) -> Option<Expr> {532 support::child(&self.syntax)533 }534}535536#[derive(Debug, Clone, PartialEq, Eq, Hash)]537pub struct ObjBodyComp {538 pub(crate) syntax: SyntaxNode,539}540impl ObjBodyComp {541 pub fn pre(&self) -> AstChildren<ObjLocalPostComma> {542 support::children(&self.syntax)543 }544 pub fn l_brack_token(&self) -> Option<SyntaxToken> {545 support::token(&self.syntax, T!['['])546 }547 pub fn key(&self) -> Option<LhsExpr> {548 support::child(&self.syntax)549 }550 pub fn r_brack_token(&self) -> Option<SyntaxToken> {551 support::token(&self.syntax, T![']'])552 }553 pub fn plus_token(&self) -> Option<SyntaxToken> {554 support::token(&self.syntax, T![+])555 }556 pub fn colon_token(&self) -> Option<SyntaxToken> {557 support::token(&self.syntax, T![:])558 }559 pub fn value(&self) -> Option<Expr> {560 support::child(&self.syntax)561 }562 pub fn post(&self) -> AstChildren<ObjLocalPreComma> {563 support::children(&self.syntax)564 }565 pub fn comp_specs(&self) -> AstChildren<CompSpec> {566 support::children(&self.syntax)567 }568}569570#[derive(Debug, Clone, PartialEq, Eq, Hash)]571pub struct ObjLocalPostComma {572 pub(crate) syntax: SyntaxNode,573}574impl ObjLocalPostComma {575 pub fn obj_local(&self) -> Option<ObjLocal> {576 support::child(&self.syntax)577 }578 pub fn comma_token(&self) -> Option<SyntaxToken> {579 support::token(&self.syntax, T![,])580 }581}582583#[derive(Debug, Clone, PartialEq, Eq, Hash)]584pub struct ObjLocalPreComma {585 pub(crate) syntax: SyntaxNode,586}587impl ObjLocalPreComma {588 pub fn comma_token(&self) -> Option<SyntaxToken> {589 support::token(&self.syntax, T![,])590 }591 pub fn obj_local(&self) -> Option<ObjLocal> {592 support::child(&self.syntax)593 }594}595596#[derive(Debug, Clone, PartialEq, Eq, Hash)]597pub struct ObjBodyMemberList {598 pub(crate) syntax: SyntaxNode,599}600impl ObjBodyMemberList {601 pub fn members(&self) -> AstChildren<Member> {602 support::children(&self.syntax)603 }604}605606#[derive(Debug, Clone, PartialEq, Eq, Hash)]607pub struct ObjLocal {608 pub(crate) syntax: SyntaxNode,609}610impl ObjLocal {611 pub fn local_kw_token(&self) -> Option<SyntaxToken> {612 support::token(&self.syntax, T![local])613 }614 pub fn bind(&self) -> Option<Bind> {615 support::child(&self.syntax)616 }617}618619#[derive(Debug, Clone, PartialEq, Eq, Hash)]620pub struct MemberBindStmt {621 pub(crate) syntax: SyntaxNode,622}623impl MemberBindStmt {624 pub fn obj_local(&self) -> Option<ObjLocal> {625 support::child(&self.syntax)626 }627}628629#[derive(Debug, Clone, PartialEq, Eq, Hash)]630pub struct MemberAssertStmt {631 pub(crate) syntax: SyntaxNode,632}633impl MemberAssertStmt {634 pub fn assertion(&self) -> Option<Assertion> {635 support::child(&self.syntax)636 }637}638639#[derive(Debug, Clone, PartialEq, Eq, Hash)]640pub struct MemberField {641 pub(crate) syntax: SyntaxNode,642}643impl MemberField {644 pub fn field(&self) -> Option<Field> {645 support::child(&self.syntax)646 }647}648649#[derive(Debug, Clone, PartialEq, Eq, Hash)]650pub struct FieldNormal {651 pub(crate) syntax: SyntaxNode,652}653impl FieldNormal {654 pub fn field_name(&self) -> Option<FieldName> {655 support::child(&self.syntax)656 }657 pub fn plus_token(&self) -> Option<SyntaxToken> {658 support::token(&self.syntax, T![+])659 }660 pub fn visibility(&self) -> Option<Visibility> {661 support::token_child(&self.syntax)662 }663 pub fn expr(&self) -> Option<Expr> {664 support::child(&self.syntax)665 }666}667668#[derive(Debug, Clone, PartialEq, Eq, Hash)]669pub struct FieldMethod {670 pub(crate) syntax: SyntaxNode,671}672impl FieldMethod {673 pub fn field_name(&self) -> Option<FieldName> {674 support::child(&self.syntax)675 }676 pub fn params_desc(&self) -> Option<ParamsDesc> {677 support::child(&self.syntax)678 }679 pub fn visibility(&self) -> Option<Visibility> {680 support::token_child(&self.syntax)681 }682 pub fn expr(&self) -> Option<Expr> {683 support::child(&self.syntax)684 }685}686687#[derive(Debug, Clone, PartialEq, Eq, Hash)]688pub struct FieldNameFixed {689 pub(crate) syntax: SyntaxNode,690}691impl FieldNameFixed {692 pub fn id(&self) -> Option<Name> {693 support::child(&self.syntax)694 }695 pub fn text(&self) -> Option<Text> {696 support::token_child(&self.syntax)697 }698}699700#[derive(Debug, Clone, PartialEq, Eq, Hash)]701pub struct FieldNameDynamic {702 pub(crate) syntax: SyntaxNode,703}704impl FieldNameDynamic {705 pub fn l_brack_token(&self) -> Option<SyntaxToken> {706 support::token(&self.syntax, T!['['])707 }708 pub fn expr(&self) -> Option<Expr> {709 support::child(&self.syntax)710 }711 pub fn r_brack_token(&self) -> Option<SyntaxToken> {712 support::token(&self.syntax, T![']'])713 }714}715716#[derive(Debug, Clone, PartialEq, Eq, Hash)]717pub struct ForSpec {718 pub(crate) syntax: SyntaxNode,719}720impl ForSpec {721 pub fn for_kw_token(&self) -> Option<SyntaxToken> {722 support::token(&self.syntax, T![for])723 }724 pub fn bind(&self) -> Option<Name> {725 support::child(&self.syntax)726 }727 pub fn in_kw_token(&self) -> Option<SyntaxToken> {728 support::token(&self.syntax, T![in])729 }730 pub fn expr(&self) -> Option<Expr> {731 support::child(&self.syntax)732 }733}734735#[derive(Debug, Clone, PartialEq, Eq, Hash)]736pub struct IfSpec {737 pub(crate) syntax: SyntaxNode,738}739impl IfSpec {740 pub fn if_kw_token(&self) -> Option<SyntaxToken> {741 support::token(&self.syntax, T![if])742 }743 pub fn expr(&self) -> Option<Expr> {744 support::child(&self.syntax)745 }746}747748#[derive(Debug, Clone, PartialEq, Eq, Hash)]749pub struct BindDestruct {750 pub(crate) syntax: SyntaxNode,751}752impl BindDestruct {753 pub fn into(&self) -> Option<Destruct> {754 support::child(&self.syntax)755 }756 pub fn assign_token(&self) -> Option<SyntaxToken> {757 support::token(&self.syntax, T![=])758 }759 pub fn value(&self) -> Option<Expr> {760 support::child(&self.syntax)761 }762}763764#[derive(Debug, Clone, PartialEq, Eq, Hash)]765pub struct BindFunction {766 pub(crate) syntax: SyntaxNode,767}768impl BindFunction {769 pub fn name(&self) -> Option<Name> {770 support::child(&self.syntax)771 }772 pub fn params(&self) -> Option<ParamsDesc> {773 support::child(&self.syntax)774 }775 pub fn assign_token(&self) -> Option<SyntaxToken> {776 support::token(&self.syntax, T![=])777 }778 pub fn value(&self) -> Option<Expr> {779 support::child(&self.syntax)780 }781}782783#[derive(Debug, Clone, PartialEq, Eq, Hash)]784pub struct Param {785 pub(crate) syntax: SyntaxNode,786}787impl Param {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 DestructFull {801 pub(crate) syntax: SyntaxNode,802}803impl DestructFull {804 pub fn name(&self) -> Option<Name> {805 support::child(&self.syntax)806 }807}808809#[derive(Debug, Clone, PartialEq, Eq, Hash)]810pub struct DestructSkip {811 pub(crate) syntax: SyntaxNode,812}813impl DestructSkip {814 pub fn question_mark_token(&self) -> Option<SyntaxToken> {815 support::token(&self.syntax, T![?])816 }817}818819#[derive(Debug, Clone, PartialEq, Eq, Hash)]820pub struct DestructArray {821 pub(crate) syntax: SyntaxNode,822}823impl DestructArray {824 pub fn l_brack_token(&self) -> Option<SyntaxToken> {825 support::token(&self.syntax, T!['['])826 }827 pub fn destruct_array_parts(&self) -> AstChildren<DestructArrayPart> {828 support::children(&self.syntax)829 }830 pub fn r_brack_token(&self) -> Option<SyntaxToken> {831 support::token(&self.syntax, T![']'])832 }833}834835#[derive(Debug, Clone, PartialEq, Eq, Hash)]836pub struct DestructObject {837 pub(crate) syntax: SyntaxNode,838}839impl DestructObject {840 pub fn l_brace_token(&self) -> Option<SyntaxToken> {841 support::token(&self.syntax, T!['{'])842 }843 pub fn destruct_object_fields(&self) -> AstChildren<DestructObjectField> {844 support::children(&self.syntax)845 }846 pub fn destruct_rest(&self) -> Option<DestructRest> {847 support::child(&self.syntax)848 }849 pub fn comma_token(&self) -> Option<SyntaxToken> {850 support::token(&self.syntax, T![,])851 }852 pub fn r_brace_token(&self) -> Option<SyntaxToken> {853 support::token(&self.syntax, T!['}'])854 }855}856857#[derive(Debug, Clone, PartialEq, Eq, Hash)]858pub struct DestructObjectField {859 pub(crate) syntax: SyntaxNode,860}861impl DestructObjectField {862 pub fn field(&self) -> Option<Name> {863 support::child(&self.syntax)864 }865 pub fn colon_token(&self) -> Option<SyntaxToken> {866 support::token(&self.syntax, T![:])867 }868 pub fn destruct(&self) -> Option<Destruct> {869 support::child(&self.syntax)870 }871 pub fn assign_token(&self) -> Option<SyntaxToken> {872 support::token(&self.syntax, T![=])873 }874 pub fn expr(&self) -> Option<Expr> {875 support::child(&self.syntax)876 }877}878879#[derive(Debug, Clone, PartialEq, Eq, Hash)]880pub struct DestructRest {881 pub(crate) syntax: SyntaxNode,882}883impl DestructRest {884 pub fn dotdotdot_token(&self) -> Option<SyntaxToken> {885 support::token(&self.syntax, T![...])886 }887 pub fn into(&self) -> Option<Name> {888 support::child(&self.syntax)889 }890}891892#[derive(Debug, Clone, PartialEq, Eq, Hash)]893pub struct DestructArrayElement {894 pub(crate) syntax: SyntaxNode,895}896impl DestructArrayElement {897 pub fn destruct(&self) -> Option<Destruct> {898 support::child(&self.syntax)899 }900}901902#[derive(Debug, Clone, PartialEq, Eq, Hash)]903pub enum Expr {904 ExprBinary(ExprBinary),905 ExprUnary(ExprUnary),906 ExprSlice(ExprSlice),907 ExprIndex(ExprIndex),908 ExprIndexExpr(ExprIndexExpr),909 ExprApply(ExprApply),910 ExprObjExtend(ExprObjExtend),911 ExprParened(ExprParened),912 ExprIntrinsicThisFile(ExprIntrinsicThisFile),913 ExprIntrinsicId(ExprIntrinsicId),914 ExprIntrinsic(ExprIntrinsic),915 ExprString(ExprString),916 ExprNumber(ExprNumber),917 ExprLiteral(ExprLiteral),918 ExprArray(ExprArray),919 ExprObject(ExprObject),920 ExprArrayComp(ExprArrayComp),921 ExprImport(ExprImport),922 ExprVar(ExprVar),923 ExprLocal(ExprLocal),924 ExprIfThenElse(ExprIfThenElse),925 ExprFunction(ExprFunction),926 ExprAssert(ExprAssert),927 ExprError(ExprError),928}929930#[derive(Debug, Clone, PartialEq, Eq, Hash)]931pub enum ObjBody {932 ObjBodyComp(ObjBodyComp),933 ObjBodyMemberList(ObjBodyMemberList),934}935936#[derive(Debug, Clone, PartialEq, Eq, Hash)]937pub enum CompSpec {938 ForSpec(ForSpec),939 IfSpec(IfSpec),940}941942#[derive(Debug, Clone, PartialEq, Eq, Hash)]943pub enum Bind {944 BindDestruct(BindDestruct),945 BindFunction(BindFunction),946}947948#[derive(Debug, Clone, PartialEq, Eq, Hash)]949pub enum Member {950 MemberBindStmt(MemberBindStmt),951 MemberAssertStmt(MemberAssertStmt),952 MemberField(MemberField),953}954955#[derive(Debug, Clone, PartialEq, Eq, Hash)]956pub enum Field {957 FieldNormal(FieldNormal),958 FieldMethod(FieldMethod),959}960961#[derive(Debug, Clone, PartialEq, Eq, Hash)]962pub enum FieldName {963 FieldNameFixed(FieldNameFixed),964 FieldNameDynamic(FieldNameDynamic),965}966967#[derive(Debug, Clone, PartialEq, Eq, Hash)]968pub enum Destruct {969 DestructFull(DestructFull),970 DestructSkip(DestructSkip),971 DestructArray(DestructArray),972 DestructObject(DestructObject),973}974975#[derive(Debug, Clone, PartialEq, Eq, Hash)]976pub enum DestructArrayPart {977 DestructArrayElement(DestructArrayElement),978 DestructRest(DestructRest),979}980981#[derive(Debug, Clone, PartialEq, Eq, Hash)]982pub struct BinaryOperator {983 syntax: SyntaxToken,984 kind: BinaryOperatorKind,985}986987#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]988pub enum BinaryOperatorKind {989 Or,990 And,991 BitOr,992 BitXor,993 BitAnd,994 Eq,995 Ne,996 Lt,997 Gt,998 Le,999 Ge,1000 InKw,1001 Lhs,1002 Rhs,1003 Plus,1004 Minus,1005 Mul,1006 Div,1007 Modulo,1008 ErrorNoOperator,1009}10101011#[derive(Debug, Clone, PartialEq, Eq, Hash)]1012pub struct UnaryOperator {1013 syntax: SyntaxToken,1014 kind: UnaryOperatorKind,1015}10161017#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]1018pub enum UnaryOperatorKind {1019 Minus,1020 Not,1021 BitNot,1022}10231024#[derive(Debug, Clone, PartialEq, Eq, Hash)]1025pub struct Literal {1026 syntax: SyntaxToken,1027 kind: LiteralKind,1028}10291030#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]1031pub enum LiteralKind {1032 NullKw,1033 TrueKw,1034 FalseKw,1035 SelfKw,1036 Dollar,1037 SuperKw,1038}10391040#[derive(Debug, Clone, PartialEq, Eq, Hash)]1041pub struct Text {1042 syntax: SyntaxToken,1043 kind: TextKind,1044}10451046#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]1047pub enum TextKind {1048 StringDouble,1049 ErrorStringDoubleUnterminated,1050 StringSingle,1051 ErrorStringSingleUnterminated,1052 StringDoubleVerbatim,1053 ErrorStringDoubleVerbatimUnterminated,1054 StringSingleVerbatim,1055 ErrorStringSingleVerbatimUnterminated,1056 ErrorStringVerbatimMissingQuotes,1057 StringBlock,1058 ErrorStringBlockUnexpectedEnd,1059 ErrorStringBlockMissingNewLine,1060 ErrorStringBlockMissingTermination,1061 ErrorStringBlockMissingIndent,1062}10631064#[derive(Debug, Clone, PartialEq, Eq, Hash)]1065pub struct Number {1066 syntax: SyntaxToken,1067 kind: NumberKind,1068}10691070#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]1071pub enum NumberKind {1072 Float,1073 ErrorFloatJunkAfterPoint,1074 ErrorFloatJunkAfterExponent,1075 ErrorFloatJunkAfterExponentSign,1076}10771078#[derive(Debug, Clone, PartialEq, Eq, Hash)]1079pub struct ImportKind {1080 syntax: SyntaxToken,1081 kind: ImportKindKind,1082}10831084#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]1085pub enum ImportKindKind {1086 ImportstrKw,1087 ImportbinKw,1088 ImportKw,1089}10901091#[derive(Debug, Clone, PartialEq, Eq, Hash)]1092pub struct Visibility {1093 syntax: SyntaxToken,1094 kind: VisibilityKind,1095}10961097#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]1098pub enum VisibilityKind {1099 Coloncoloncolon,1100 Coloncolon,1101 Colon,1102}11031104#[derive(Debug, Clone, PartialEq, Eq, Hash)]1105pub struct Trivia {1106 syntax: SyntaxToken,1107 kind: TriviaKind,1108}11091110#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]1111pub enum TriviaKind {1112 Whitespace,1113 MultiLineComment,1114 ErrorCommentTooShort,1115 ErrorCommentUnterminated,1116 SingleLineHashComment,1117 SingleLineSlashComment,1118}1119impl AstNode for SourceFile {1120 fn can_cast(kind: SyntaxKind) -> bool {1121 kind == SOURCE_FILE1122 }1123 fn cast(syntax: SyntaxNode) -> Option<Self> {1124 if Self::can_cast(syntax.kind()) {1125 Some(Self { syntax })1126 } else {1127 None1128 }1129 }1130 fn syntax(&self) -> &SyntaxNode {1131 &self.syntax1132 }1133}1134impl AstNode for ExprBinary {1135 fn can_cast(kind: SyntaxKind) -> bool {1136 kind == EXPR_BINARY1137 }1138 fn cast(syntax: SyntaxNode) -> Option<Self> {1139 if Self::can_cast(syntax.kind()) {1140 Some(Self { syntax })1141 } else {1142 None1143 }1144 }1145 fn syntax(&self) -> &SyntaxNode {1146 &self.syntax1147 }1148}1149impl AstNode for LhsExpr {1150 fn can_cast(kind: SyntaxKind) -> bool {1151 kind == LHS_EXPR1152 }1153 fn cast(syntax: SyntaxNode) -> Option<Self> {1154 if Self::can_cast(syntax.kind()) {1155 Some(Self { syntax })1156 } else {1157 None1158 }1159 }1160 fn syntax(&self) -> &SyntaxNode {1161 &self.syntax1162 }1163}1164impl AstNode for ExprUnary {1165 fn can_cast(kind: SyntaxKind) -> bool {1166 kind == EXPR_UNARY1167 }1168 fn cast(syntax: SyntaxNode) -> Option<Self> {1169 if Self::can_cast(syntax.kind()) {1170 Some(Self { syntax })1171 } else {1172 None1173 }1174 }1175 fn syntax(&self) -> &SyntaxNode {1176 &self.syntax1177 }1178}1179impl AstNode for ExprSlice {1180 fn can_cast(kind: SyntaxKind) -> bool {1181 kind == EXPR_SLICE1182 }1183 fn cast(syntax: SyntaxNode) -> Option<Self> {1184 if Self::can_cast(syntax.kind()) {1185 Some(Self { syntax })1186 } else {1187 None1188 }1189 }1190 fn syntax(&self) -> &SyntaxNode {1191 &self.syntax1192 }1193}1194impl AstNode for SliceDesc {1195 fn can_cast(kind: SyntaxKind) -> bool {1196 kind == SLICE_DESC1197 }1198 fn cast(syntax: SyntaxNode) -> Option<Self> {1199 if Self::can_cast(syntax.kind()) {1200 Some(Self { syntax })1201 } else {1202 None1203 }1204 }1205 fn syntax(&self) -> &SyntaxNode {1206 &self.syntax1207 }1208}1209impl AstNode for ExprIndex {1210 fn can_cast(kind: SyntaxKind) -> bool {1211 kind == EXPR_INDEX1212 }1213 fn cast(syntax: SyntaxNode) -> Option<Self> {1214 if Self::can_cast(syntax.kind()) {1215 Some(Self { syntax })1216 } else {1217 None1218 }1219 }1220 fn syntax(&self) -> &SyntaxNode {1221 &self.syntax1222 }1223}1224impl AstNode for Name {1225 fn can_cast(kind: SyntaxKind) -> bool {1226 kind == NAME1227 }1228 fn cast(syntax: SyntaxNode) -> Option<Self> {1229 if Self::can_cast(syntax.kind()) {1230 Some(Self { syntax })1231 } else {1232 None1233 }1234 }1235 fn syntax(&self) -> &SyntaxNode {1236 &self.syntax1237 }1238}1239impl AstNode for ExprIndexExpr {1240 fn can_cast(kind: SyntaxKind) -> bool {1241 kind == EXPR_INDEX_EXPR1242 }1243 fn cast(syntax: SyntaxNode) -> Option<Self> {1244 if Self::can_cast(syntax.kind()) {1245 Some(Self { syntax })1246 } else {1247 None1248 }1249 }1250 fn syntax(&self) -> &SyntaxNode {1251 &self.syntax1252 }1253}1254impl AstNode for ExprApply {1255 fn can_cast(kind: SyntaxKind) -> bool {1256 kind == EXPR_APPLY1257 }1258 fn cast(syntax: SyntaxNode) -> Option<Self> {1259 if Self::can_cast(syntax.kind()) {1260 Some(Self { syntax })1261 } else {1262 None1263 }1264 }1265 fn syntax(&self) -> &SyntaxNode {1266 &self.syntax1267 }1268}1269impl AstNode for ArgsDesc {1270 fn can_cast(kind: SyntaxKind) -> bool {1271 kind == ARGS_DESC1272 }1273 fn cast(syntax: SyntaxNode) -> Option<Self> {1274 if Self::can_cast(syntax.kind()) {1275 Some(Self { syntax })1276 } else {1277 None1278 }1279 }1280 fn syntax(&self) -> &SyntaxNode {1281 &self.syntax1282 }1283}1284impl AstNode for ExprObjExtend {1285 fn can_cast(kind: SyntaxKind) -> bool {1286 kind == EXPR_OBJ_EXTEND1287 }1288 fn cast(syntax: SyntaxNode) -> Option<Self> {1289 if Self::can_cast(syntax.kind()) {1290 Some(Self { syntax })1291 } else {1292 None1293 }1294 }1295 fn syntax(&self) -> &SyntaxNode {1296 &self.syntax1297 }1298}1299impl AstNode for ExprParened {1300 fn can_cast(kind: SyntaxKind) -> bool {1301 kind == EXPR_PARENED1302 }1303 fn cast(syntax: SyntaxNode) -> Option<Self> {1304 if Self::can_cast(syntax.kind()) {1305 Some(Self { syntax })1306 } else {1307 None1308 }1309 }1310 fn syntax(&self) -> &SyntaxNode {1311 &self.syntax1312 }1313}1314impl AstNode for ExprLiteral {1315 fn can_cast(kind: SyntaxKind) -> bool {1316 kind == EXPR_LITERAL1317 }1318 fn cast(syntax: SyntaxNode) -> Option<Self> {1319 if Self::can_cast(syntax.kind()) {1320 Some(Self { syntax })1321 } else {1322 None1323 }1324 }1325 fn syntax(&self) -> &SyntaxNode {1326 &self.syntax1327 }1328}1329impl AstNode for ExprIntrinsicThisFile {1330 fn can_cast(kind: SyntaxKind) -> bool {1331 kind == EXPR_INTRINSIC_THIS_FILE1332 }1333 fn cast(syntax: SyntaxNode) -> Option<Self> {1334 if Self::can_cast(syntax.kind()) {1335 Some(Self { syntax })1336 } else {1337 None1338 }1339 }1340 fn syntax(&self) -> &SyntaxNode {1341 &self.syntax1342 }1343}1344impl AstNode for ExprIntrinsicId {1345 fn can_cast(kind: SyntaxKind) -> bool {1346 kind == EXPR_INTRINSIC_ID1347 }1348 fn cast(syntax: SyntaxNode) -> Option<Self> {1349 if Self::can_cast(syntax.kind()) {1350 Some(Self { syntax })1351 } else {1352 None1353 }1354 }1355 fn syntax(&self) -> &SyntaxNode {1356 &self.syntax1357 }1358}1359impl AstNode for ExprIntrinsic {1360 fn can_cast(kind: SyntaxKind) -> bool {1361 kind == EXPR_INTRINSIC1362 }1363 fn cast(syntax: SyntaxNode) -> Option<Self> {1364 if Self::can_cast(syntax.kind()) {1365 Some(Self { syntax })1366 } else {1367 None1368 }1369 }1370 fn syntax(&self) -> &SyntaxNode {1371 &self.syntax1372 }1373}1374impl AstNode for ExprString {1375 fn can_cast(kind: SyntaxKind) -> bool {1376 kind == EXPR_STRING1377 }1378 fn cast(syntax: SyntaxNode) -> Option<Self> {1379 if Self::can_cast(syntax.kind()) {1380 Some(Self { syntax })1381 } else {1382 None1383 }1384 }1385 fn syntax(&self) -> &SyntaxNode {1386 &self.syntax1387 }1388}1389impl AstNode for ExprNumber {1390 fn can_cast(kind: SyntaxKind) -> bool {1391 kind == EXPR_NUMBER1392 }1393 fn cast(syntax: SyntaxNode) -> Option<Self> {1394 if Self::can_cast(syntax.kind()) {1395 Some(Self { syntax })1396 } else {1397 None1398 }1399 }1400 fn syntax(&self) -> &SyntaxNode {1401 &self.syntax1402 }1403}1404impl AstNode for ExprArray {1405 fn can_cast(kind: SyntaxKind) -> bool {1406 kind == EXPR_ARRAY1407 }1408 fn cast(syntax: SyntaxNode) -> Option<Self> {1409 if Self::can_cast(syntax.kind()) {1410 Some(Self { syntax })1411 } else {1412 None1413 }1414 }1415 fn syntax(&self) -> &SyntaxNode {1416 &self.syntax1417 }1418}1419impl AstNode for ExprObject {1420 fn can_cast(kind: SyntaxKind) -> bool {1421 kind == EXPR_OBJECT1422 }1423 fn cast(syntax: SyntaxNode) -> Option<Self> {1424 if Self::can_cast(syntax.kind()) {1425 Some(Self { syntax })1426 } else {1427 None1428 }1429 }1430 fn syntax(&self) -> &SyntaxNode {1431 &self.syntax1432 }1433}1434impl AstNode for ExprArrayComp {1435 fn can_cast(kind: SyntaxKind) -> bool {1436 kind == EXPR_ARRAY_COMP1437 }1438 fn cast(syntax: SyntaxNode) -> Option<Self> {1439 if Self::can_cast(syntax.kind()) {1440 Some(Self { syntax })1441 } else {1442 None1443 }1444 }1445 fn syntax(&self) -> &SyntaxNode {1446 &self.syntax1447 }1448}1449impl AstNode for ExprImport {1450 fn can_cast(kind: SyntaxKind) -> bool {1451 kind == EXPR_IMPORT1452 }1453 fn cast(syntax: SyntaxNode) -> Option<Self> {1454 if Self::can_cast(syntax.kind()) {1455 Some(Self { syntax })1456 } else {1457 None1458 }1459 }1460 fn syntax(&self) -> &SyntaxNode {1461 &self.syntax1462 }1463}1464impl AstNode for ExprVar {1465 fn can_cast(kind: SyntaxKind) -> bool {1466 kind == EXPR_VAR1467 }1468 fn cast(syntax: SyntaxNode) -> Option<Self> {1469 if Self::can_cast(syntax.kind()) {1470 Some(Self { syntax })1471 } else {1472 None1473 }1474 }1475 fn syntax(&self) -> &SyntaxNode {1476 &self.syntax1477 }1478}1479impl AstNode for ExprLocal {1480 fn can_cast(kind: SyntaxKind) -> bool {1481 kind == EXPR_LOCAL1482 }1483 fn cast(syntax: SyntaxNode) -> Option<Self> {1484 if Self::can_cast(syntax.kind()) {1485 Some(Self { syntax })1486 } else {1487 None1488 }1489 }1490 fn syntax(&self) -> &SyntaxNode {1491 &self.syntax1492 }1493}1494impl AstNode for ExprIfThenElse {1495 fn can_cast(kind: SyntaxKind) -> bool {1496 kind == EXPR_IF_THEN_ELSE1497 }1498 fn cast(syntax: SyntaxNode) -> Option<Self> {1499 if Self::can_cast(syntax.kind()) {1500 Some(Self { syntax })1501 } else {1502 None1503 }1504 }1505 fn syntax(&self) -> &SyntaxNode {1506 &self.syntax1507 }1508}1509impl AstNode for TrueExpr {1510 fn can_cast(kind: SyntaxKind) -> bool {1511 kind == TRUE_EXPR1512 }1513 fn cast(syntax: SyntaxNode) -> Option<Self> {1514 if Self::can_cast(syntax.kind()) {1515 Some(Self { syntax })1516 } else {1517 None1518 }1519 }1520 fn syntax(&self) -> &SyntaxNode {1521 &self.syntax1522 }1523}1524impl AstNode for FalseExpr {1525 fn can_cast(kind: SyntaxKind) -> bool {1526 kind == FALSE_EXPR1527 }1528 fn cast(syntax: SyntaxNode) -> Option<Self> {1529 if Self::can_cast(syntax.kind()) {1530 Some(Self { syntax })1531 } else {1532 None1533 }1534 }1535 fn syntax(&self) -> &SyntaxNode {1536 &self.syntax1537 }1538}1539impl AstNode for ExprFunction {1540 fn can_cast(kind: SyntaxKind) -> bool {1541 kind == EXPR_FUNCTION1542 }1543 fn cast(syntax: SyntaxNode) -> Option<Self> {1544 if Self::can_cast(syntax.kind()) {1545 Some(Self { syntax })1546 } else {1547 None1548 }1549 }1550 fn syntax(&self) -> &SyntaxNode {1551 &self.syntax1552 }1553}1554impl AstNode for ParamsDesc {1555 fn can_cast(kind: SyntaxKind) -> bool {1556 kind == PARAMS_DESC1557 }1558 fn cast(syntax: SyntaxNode) -> Option<Self> {1559 if Self::can_cast(syntax.kind()) {1560 Some(Self { syntax })1561 } else {1562 None1563 }1564 }1565 fn syntax(&self) -> &SyntaxNode {1566 &self.syntax1567 }1568}1569impl AstNode for ExprAssert {1570 fn can_cast(kind: SyntaxKind) -> bool {1571 kind == EXPR_ASSERT1572 }1573 fn cast(syntax: SyntaxNode) -> Option<Self> {1574 if Self::can_cast(syntax.kind()) {1575 Some(Self { syntax })1576 } else {1577 None1578 }1579 }1580 fn syntax(&self) -> &SyntaxNode {1581 &self.syntax1582 }1583}1584impl AstNode for Assertion {1585 fn can_cast(kind: SyntaxKind) -> bool {1586 kind == ASSERTION1587 }1588 fn cast(syntax: SyntaxNode) -> Option<Self> {1589 if Self::can_cast(syntax.kind()) {1590 Some(Self { syntax })1591 } else {1592 None1593 }1594 }1595 fn syntax(&self) -> &SyntaxNode {1596 &self.syntax1597 }1598}1599impl AstNode for ExprError {1600 fn can_cast(kind: SyntaxKind) -> bool {1601 kind == EXPR_ERROR1602 }1603 fn cast(syntax: SyntaxNode) -> Option<Self> {1604 if Self::can_cast(syntax.kind()) {1605 Some(Self { syntax })1606 } else {1607 None1608 }1609 }1610 fn syntax(&self) -> &SyntaxNode {1611 &self.syntax1612 }1613}1614impl AstNode for SliceDescEnd {1615 fn can_cast(kind: SyntaxKind) -> bool {1616 kind == SLICE_DESC_END1617 }1618 fn cast(syntax: SyntaxNode) -> Option<Self> {1619 if Self::can_cast(syntax.kind()) {1620 Some(Self { syntax })1621 } else {1622 None1623 }1624 }1625 fn syntax(&self) -> &SyntaxNode {1626 &self.syntax1627 }1628}1629impl AstNode for SliceDescStep {1630 fn can_cast(kind: SyntaxKind) -> bool {1631 kind == SLICE_DESC_STEP1632 }1633 fn cast(syntax: SyntaxNode) -> Option<Self> {1634 if Self::can_cast(syntax.kind()) {1635 Some(Self { syntax })1636 } else {1637 None1638 }1639 }1640 fn syntax(&self) -> &SyntaxNode {1641 &self.syntax1642 }1643}1644impl AstNode for Arg {1645 fn can_cast(kind: SyntaxKind) -> bool {1646 kind == ARG1647 }1648 fn cast(syntax: SyntaxNode) -> Option<Self> {1649 if Self::can_cast(syntax.kind()) {1650 Some(Self { syntax })1651 } else {1652 None1653 }1654 }1655 fn syntax(&self) -> &SyntaxNode {1656 &self.syntax1657 }1658}1659impl AstNode for ObjBodyComp {1660 fn can_cast(kind: SyntaxKind) -> bool {1661 kind == OBJ_BODY_COMP1662 }1663 fn cast(syntax: SyntaxNode) -> Option<Self> {1664 if Self::can_cast(syntax.kind()) {1665 Some(Self { syntax })1666 } else {1667 None1668 }1669 }1670 fn syntax(&self) -> &SyntaxNode {1671 &self.syntax1672 }1673}1674impl AstNode for ObjLocalPostComma {1675 fn can_cast(kind: SyntaxKind) -> bool {1676 kind == OBJ_LOCAL_POST_COMMA1677 }1678 fn cast(syntax: SyntaxNode) -> Option<Self> {1679 if Self::can_cast(syntax.kind()) {1680 Some(Self { syntax })1681 } else {1682 None1683 }1684 }1685 fn syntax(&self) -> &SyntaxNode {1686 &self.syntax1687 }1688}1689impl AstNode for ObjLocalPreComma {1690 fn can_cast(kind: SyntaxKind) -> bool {1691 kind == OBJ_LOCAL_PRE_COMMA1692 }1693 fn cast(syntax: SyntaxNode) -> Option<Self> {1694 if Self::can_cast(syntax.kind()) {1695 Some(Self { syntax })1696 } else {1697 None1698 }1699 }1700 fn syntax(&self) -> &SyntaxNode {1701 &self.syntax1702 }1703}1704impl AstNode for ObjBodyMemberList {1705 fn can_cast(kind: SyntaxKind) -> bool {1706 kind == OBJ_BODY_MEMBER_LIST1707 }1708 fn cast(syntax: SyntaxNode) -> Option<Self> {1709 if Self::can_cast(syntax.kind()) {1710 Some(Self { syntax })1711 } else {1712 None1713 }1714 }1715 fn syntax(&self) -> &SyntaxNode {1716 &self.syntax1717 }1718}1719impl AstNode for ObjLocal {1720 fn can_cast(kind: SyntaxKind) -> bool {1721 kind == OBJ_LOCAL1722 }1723 fn cast(syntax: SyntaxNode) -> Option<Self> {1724 if Self::can_cast(syntax.kind()) {1725 Some(Self { syntax })1726 } else {1727 None1728 }1729 }1730 fn syntax(&self) -> &SyntaxNode {1731 &self.syntax1732 }1733}1734impl AstNode for MemberBindStmt {1735 fn can_cast(kind: SyntaxKind) -> bool {1736 kind == MEMBER_BIND_STMT1737 }1738 fn cast(syntax: SyntaxNode) -> Option<Self> {1739 if Self::can_cast(syntax.kind()) {1740 Some(Self { syntax })1741 } else {1742 None1743 }1744 }1745 fn syntax(&self) -> &SyntaxNode {1746 &self.syntax1747 }1748}1749impl AstNode for MemberAssertStmt {1750 fn can_cast(kind: SyntaxKind) -> bool {1751 kind == MEMBER_ASSERT_STMT1752 }1753 fn cast(syntax: SyntaxNode) -> Option<Self> {1754 if Self::can_cast(syntax.kind()) {1755 Some(Self { syntax })1756 } else {1757 None1758 }1759 }1760 fn syntax(&self) -> &SyntaxNode {1761 &self.syntax1762 }1763}1764impl AstNode for MemberField {1765 fn can_cast(kind: SyntaxKind) -> bool {1766 kind == MEMBER_FIELD1767 }1768 fn cast(syntax: SyntaxNode) -> Option<Self> {1769 if Self::can_cast(syntax.kind()) {1770 Some(Self { syntax })1771 } else {1772 None1773 }1774 }1775 fn syntax(&self) -> &SyntaxNode {1776 &self.syntax1777 }1778}1779impl AstNode for FieldNormal {1780 fn can_cast(kind: SyntaxKind) -> bool {1781 kind == FIELD_NORMAL1782 }1783 fn cast(syntax: SyntaxNode) -> Option<Self> {1784 if Self::can_cast(syntax.kind()) {1785 Some(Self { syntax })1786 } else {1787 None1788 }1789 }1790 fn syntax(&self) -> &SyntaxNode {1791 &self.syntax1792 }1793}1794impl AstNode for FieldMethod {1795 fn can_cast(kind: SyntaxKind) -> bool {1796 kind == FIELD_METHOD1797 }1798 fn cast(syntax: SyntaxNode) -> Option<Self> {1799 if Self::can_cast(syntax.kind()) {1800 Some(Self { syntax })1801 } else {1802 None1803 }1804 }1805 fn syntax(&self) -> &SyntaxNode {1806 &self.syntax1807 }1808}1809impl AstNode for FieldNameFixed {1810 fn can_cast(kind: SyntaxKind) -> bool {1811 kind == FIELD_NAME_FIXED1812 }1813 fn cast(syntax: SyntaxNode) -> Option<Self> {1814 if Self::can_cast(syntax.kind()) {1815 Some(Self { syntax })1816 } else {1817 None1818 }1819 }1820 fn syntax(&self) -> &SyntaxNode {1821 &self.syntax1822 }1823}1824impl AstNode for FieldNameDynamic {1825 fn can_cast(kind: SyntaxKind) -> bool {1826 kind == FIELD_NAME_DYNAMIC1827 }1828 fn cast(syntax: SyntaxNode) -> Option<Self> {1829 if Self::can_cast(syntax.kind()) {1830 Some(Self { syntax })1831 } else {1832 None1833 }1834 }1835 fn syntax(&self) -> &SyntaxNode {1836 &self.syntax1837 }1838}1839impl AstNode for ForSpec {1840 fn can_cast(kind: SyntaxKind) -> bool {1841 kind == FOR_SPEC1842 }1843 fn cast(syntax: SyntaxNode) -> Option<Self> {1844 if Self::can_cast(syntax.kind()) {1845 Some(Self { syntax })1846 } else {1847 None1848 }1849 }1850 fn syntax(&self) -> &SyntaxNode {1851 &self.syntax1852 }1853}1854impl AstNode for IfSpec {1855 fn can_cast(kind: SyntaxKind) -> bool {1856 kind == IF_SPEC1857 }1858 fn cast(syntax: SyntaxNode) -> Option<Self> {1859 if Self::can_cast(syntax.kind()) {1860 Some(Self { syntax })1861 } else {1862 None1863 }1864 }1865 fn syntax(&self) -> &SyntaxNode {1866 &self.syntax1867 }1868}1869impl AstNode for BindDestruct {1870 fn can_cast(kind: SyntaxKind) -> bool {1871 kind == BIND_DESTRUCT1872 }1873 fn cast(syntax: SyntaxNode) -> Option<Self> {1874 if Self::can_cast(syntax.kind()) {1875 Some(Self { syntax })1876 } else {1877 None1878 }1879 }1880 fn syntax(&self) -> &SyntaxNode {1881 &self.syntax1882 }1883}1884impl AstNode for BindFunction {1885 fn can_cast(kind: SyntaxKind) -> bool {1886 kind == BIND_FUNCTION1887 }1888 fn cast(syntax: SyntaxNode) -> Option<Self> {1889 if Self::can_cast(syntax.kind()) {1890 Some(Self { syntax })1891 } else {1892 None1893 }1894 }1895 fn syntax(&self) -> &SyntaxNode {1896 &self.syntax1897 }1898}1899impl AstNode for Param {1900 fn can_cast(kind: SyntaxKind) -> bool {1901 kind == PARAM1902 }1903 fn cast(syntax: SyntaxNode) -> Option<Self> {1904 if Self::can_cast(syntax.kind()) {1905 Some(Self { syntax })1906 } else {1907 None1908 }1909 }1910 fn syntax(&self) -> &SyntaxNode {1911 &self.syntax1912 }1913}1914impl AstNode for DestructFull {1915 fn can_cast(kind: SyntaxKind) -> bool {1916 kind == DESTRUCT_FULL1917 }1918 fn cast(syntax: SyntaxNode) -> Option<Self> {1919 if Self::can_cast(syntax.kind()) {1920 Some(Self { syntax })1921 } else {1922 None1923 }1924 }1925 fn syntax(&self) -> &SyntaxNode {1926 &self.syntax1927 }1928}1929impl AstNode for DestructSkip {1930 fn can_cast(kind: SyntaxKind) -> bool {1931 kind == DESTRUCT_SKIP1932 }1933 fn cast(syntax: SyntaxNode) -> Option<Self> {1934 if Self::can_cast(syntax.kind()) {1935 Some(Self { syntax })1936 } else {1937 None1938 }1939 }1940 fn syntax(&self) -> &SyntaxNode {1941 &self.syntax1942 }1943}1944impl AstNode for DestructArray {1945 fn can_cast(kind: SyntaxKind) -> bool {1946 kind == DESTRUCT_ARRAY1947 }1948 fn cast(syntax: SyntaxNode) -> Option<Self> {1949 if Self::can_cast(syntax.kind()) {1950 Some(Self { syntax })1951 } else {1952 None1953 }1954 }1955 fn syntax(&self) -> &SyntaxNode {1956 &self.syntax1957 }1958}1959impl AstNode for DestructObject {1960 fn can_cast(kind: SyntaxKind) -> bool {1961 kind == DESTRUCT_OBJECT1962 }1963 fn cast(syntax: SyntaxNode) -> Option<Self> {1964 if Self::can_cast(syntax.kind()) {1965 Some(Self { syntax })1966 } else {1967 None1968 }1969 }1970 fn syntax(&self) -> &SyntaxNode {1971 &self.syntax1972 }1973}1974impl AstNode for DestructObjectField {1975 fn can_cast(kind: SyntaxKind) -> bool {1976 kind == DESTRUCT_OBJECT_FIELD1977 }1978 fn cast(syntax: SyntaxNode) -> Option<Self> {1979 if Self::can_cast(syntax.kind()) {1980 Some(Self { syntax })1981 } else {1982 None1983 }1984 }1985 fn syntax(&self) -> &SyntaxNode {1986 &self.syntax1987 }1988}1989impl AstNode for DestructRest {1990 fn can_cast(kind: SyntaxKind) -> bool {1991 kind == DESTRUCT_REST1992 }1993 fn cast(syntax: SyntaxNode) -> Option<Self> {1994 if Self::can_cast(syntax.kind()) {1995 Some(Self { syntax })1996 } else {1997 None1998 }1999 }2000 fn syntax(&self) -> &SyntaxNode {2001 &self.syntax2002 }2003}2004impl AstNode for DestructArrayElement {2005 fn can_cast(kind: SyntaxKind) -> bool {2006 kind == DESTRUCT_ARRAY_ELEMENT2007 }2008 fn cast(syntax: SyntaxNode) -> Option<Self> {2009 if Self::can_cast(syntax.kind()) {2010 Some(Self { syntax })2011 } else {2012 None2013 }2014 }2015 fn syntax(&self) -> &SyntaxNode {2016 &self.syntax2017 }2018}2019impl From<ExprBinary> for Expr {2020 fn from(node: ExprBinary) -> Expr {2021 Expr::ExprBinary(node)2022 }2023}2024impl From<ExprUnary> for Expr {2025 fn from(node: ExprUnary) -> Expr {2026 Expr::ExprUnary(node)2027 }2028}2029impl From<ExprSlice> for Expr {2030 fn from(node: ExprSlice) -> Expr {2031 Expr::ExprSlice(node)2032 }2033}2034impl From<ExprIndex> for Expr {2035 fn from(node: ExprIndex) -> Expr {2036 Expr::ExprIndex(node)2037 }2038}2039impl From<ExprIndexExpr> for Expr {2040 fn from(node: ExprIndexExpr) -> Expr {2041 Expr::ExprIndexExpr(node)2042 }2043}2044impl From<ExprApply> for Expr {2045 fn from(node: ExprApply) -> Expr {2046 Expr::ExprApply(node)2047 }2048}2049impl From<ExprObjExtend> for Expr {2050 fn from(node: ExprObjExtend) -> Expr {2051 Expr::ExprObjExtend(node)2052 }2053}2054impl From<ExprParened> for Expr {2055 fn from(node: ExprParened) -> Expr {2056 Expr::ExprParened(node)2057 }2058}2059impl From<ExprIntrinsicThisFile> for Expr {2060 fn from(node: ExprIntrinsicThisFile) -> Expr {2061 Expr::ExprIntrinsicThisFile(node)2062 }2063}2064impl From<ExprIntrinsicId> for Expr {2065 fn from(node: ExprIntrinsicId) -> Expr {2066 Expr::ExprIntrinsicId(node)2067 }2068}2069impl From<ExprIntrinsic> for Expr {2070 fn from(node: ExprIntrinsic) -> Expr {2071 Expr::ExprIntrinsic(node)2072 }2073}2074impl From<ExprString> for Expr {2075 fn from(node: ExprString) -> Expr {2076 Expr::ExprString(node)2077 }2078}2079impl From<ExprNumber> for Expr {2080 fn from(node: ExprNumber) -> Expr {2081 Expr::ExprNumber(node)2082 }2083}2084impl From<ExprLiteral> for Expr {2085 fn from(node: ExprLiteral) -> Expr {2086 Expr::ExprLiteral(node)2087 }2088}2089impl From<ExprArray> for Expr {2090 fn from(node: ExprArray) -> Expr {2091 Expr::ExprArray(node)2092 }2093}2094impl From<ExprObject> for Expr {2095 fn from(node: ExprObject) -> Expr {2096 Expr::ExprObject(node)2097 }2098}2099impl From<ExprArrayComp> for Expr {2100 fn from(node: ExprArrayComp) -> Expr {2101 Expr::ExprArrayComp(node)2102 }2103}2104impl From<ExprImport> for Expr {2105 fn from(node: ExprImport) -> Expr {2106 Expr::ExprImport(node)2107 }2108}2109impl From<ExprVar> for Expr {2110 fn from(node: ExprVar) -> Expr {2111 Expr::ExprVar(node)2112 }2113}2114impl From<ExprLocal> for Expr {2115 fn from(node: ExprLocal) -> Expr {2116 Expr::ExprLocal(node)2117 }2118}2119impl From<ExprIfThenElse> for Expr {2120 fn from(node: ExprIfThenElse) -> Expr {2121 Expr::ExprIfThenElse(node)2122 }2123}2124impl From<ExprFunction> for Expr {2125 fn from(node: ExprFunction) -> Expr {2126 Expr::ExprFunction(node)2127 }2128}2129impl From<ExprAssert> for Expr {2130 fn from(node: ExprAssert) -> Expr {2131 Expr::ExprAssert(node)2132 }2133}2134impl From<ExprError> for Expr {2135 fn from(node: ExprError) -> Expr {2136 Expr::ExprError(node)2137 }2138}2139impl AstNode for Expr {2140 fn can_cast(kind: SyntaxKind) -> bool {2141 match kind {2142 EXPR_BINARY2143 | EXPR_UNARY2144 | EXPR_SLICE2145 | EXPR_INDEX2146 | EXPR_INDEX_EXPR2147 | EXPR_APPLY2148 | EXPR_OBJ_EXTEND2149 | EXPR_PARENED2150 | EXPR_INTRINSIC_THIS_FILE2151 | EXPR_INTRINSIC_ID2152 | EXPR_INTRINSIC2153 | EXPR_STRING2154 | EXPR_NUMBER2155 | EXPR_LITERAL2156 | EXPR_ARRAY2157 | EXPR_OBJECT2158 | EXPR_ARRAY_COMP2159 | EXPR_IMPORT2160 | EXPR_VAR2161 | EXPR_LOCAL2162 | EXPR_IF_THEN_ELSE2163 | EXPR_FUNCTION2164 | EXPR_ASSERT2165 | EXPR_ERROR => true,2166 _ => false,2167 }2168 }2169 fn cast(syntax: SyntaxNode) -> Option<Self> {2170 let res = match syntax.kind() {2171 EXPR_BINARY => Expr::ExprBinary(ExprBinary { syntax }),2172 EXPR_UNARY => Expr::ExprUnary(ExprUnary { syntax }),2173 EXPR_SLICE => Expr::ExprSlice(ExprSlice { syntax }),2174 EXPR_INDEX => Expr::ExprIndex(ExprIndex { syntax }),2175 EXPR_INDEX_EXPR => Expr::ExprIndexExpr(ExprIndexExpr { syntax }),2176 EXPR_APPLY => Expr::ExprApply(ExprApply { syntax }),2177 EXPR_OBJ_EXTEND => Expr::ExprObjExtend(ExprObjExtend { syntax }),2178 EXPR_PARENED => Expr::ExprParened(ExprParened { syntax }),2179 EXPR_INTRINSIC_THIS_FILE => {2180 Expr::ExprIntrinsicThisFile(ExprIntrinsicThisFile { syntax })2181 }2182 EXPR_INTRINSIC_ID => Expr::ExprIntrinsicId(ExprIntrinsicId { syntax }),2183 EXPR_INTRINSIC => Expr::ExprIntrinsic(ExprIntrinsic { syntax }),2184 EXPR_STRING => Expr::ExprString(ExprString { syntax }),2185 EXPR_NUMBER => Expr::ExprNumber(ExprNumber { syntax }),2186 EXPR_LITERAL => Expr::ExprLiteral(ExprLiteral { syntax }),2187 EXPR_ARRAY => Expr::ExprArray(ExprArray { syntax }),2188 EXPR_OBJECT => Expr::ExprObject(ExprObject { syntax }),2189 EXPR_ARRAY_COMP => Expr::ExprArrayComp(ExprArrayComp { syntax }),2190 EXPR_IMPORT => Expr::ExprImport(ExprImport { syntax }),2191 EXPR_VAR => Expr::ExprVar(ExprVar { syntax }),2192 EXPR_LOCAL => Expr::ExprLocal(ExprLocal { syntax }),2193 EXPR_IF_THEN_ELSE => Expr::ExprIfThenElse(ExprIfThenElse { syntax }),2194 EXPR_FUNCTION => Expr::ExprFunction(ExprFunction { syntax }),2195 EXPR_ASSERT => Expr::ExprAssert(ExprAssert { syntax }),2196 EXPR_ERROR => Expr::ExprError(ExprError { syntax }),2197 _ => return None,2198 };2199 Some(res)2200 }2201 fn syntax(&self) -> &SyntaxNode {2202 match self {2203 Expr::ExprBinary(it) => &it.syntax,2204 Expr::ExprUnary(it) => &it.syntax,2205 Expr::ExprSlice(it) => &it.syntax,2206 Expr::ExprIndex(it) => &it.syntax,2207 Expr::ExprIndexExpr(it) => &it.syntax,2208 Expr::ExprApply(it) => &it.syntax,2209 Expr::ExprObjExtend(it) => &it.syntax,2210 Expr::ExprParened(it) => &it.syntax,2211 Expr::ExprIntrinsicThisFile(it) => &it.syntax,2212 Expr::ExprIntrinsicId(it) => &it.syntax,2213 Expr::ExprIntrinsic(it) => &it.syntax,2214 Expr::ExprString(it) => &it.syntax,2215 Expr::ExprNumber(it) => &it.syntax,2216 Expr::ExprLiteral(it) => &it.syntax,2217 Expr::ExprArray(it) => &it.syntax,2218 Expr::ExprObject(it) => &it.syntax,2219 Expr::ExprArrayComp(it) => &it.syntax,2220 Expr::ExprImport(it) => &it.syntax,2221 Expr::ExprVar(it) => &it.syntax,2222 Expr::ExprLocal(it) => &it.syntax,2223 Expr::ExprIfThenElse(it) => &it.syntax,2224 Expr::ExprFunction(it) => &it.syntax,2225 Expr::ExprAssert(it) => &it.syntax,2226 Expr::ExprError(it) => &it.syntax,2227 }2228 }2229}2230impl From<ObjBodyComp> for ObjBody {2231 fn from(node: ObjBodyComp) -> ObjBody {2232 ObjBody::ObjBodyComp(node)2233 }2234}2235impl From<ObjBodyMemberList> for ObjBody {2236 fn from(node: ObjBodyMemberList) -> ObjBody {2237 ObjBody::ObjBodyMemberList(node)2238 }2239}2240impl AstNode for ObjBody {2241 fn can_cast(kind: SyntaxKind) -> bool {2242 match kind {2243 OBJ_BODY_COMP | OBJ_BODY_MEMBER_LIST => true,2244 _ => false,2245 }2246 }2247 fn cast(syntax: SyntaxNode) -> Option<Self> {2248 let res = match syntax.kind() {2249 OBJ_BODY_COMP => ObjBody::ObjBodyComp(ObjBodyComp { syntax }),2250 OBJ_BODY_MEMBER_LIST => ObjBody::ObjBodyMemberList(ObjBodyMemberList { syntax }),2251 _ => return None,2252 };2253 Some(res)2254 }2255 fn syntax(&self) -> &SyntaxNode {2256 match self {2257 ObjBody::ObjBodyComp(it) => &it.syntax,2258 ObjBody::ObjBodyMemberList(it) => &it.syntax,2259 }2260 }2261}2262impl From<ForSpec> for CompSpec {2263 fn from(node: ForSpec) -> CompSpec {2264 CompSpec::ForSpec(node)2265 }2266}2267impl From<IfSpec> for CompSpec {2268 fn from(node: IfSpec) -> CompSpec {2269 CompSpec::IfSpec(node)2270 }2271}2272impl AstNode for CompSpec {2273 fn can_cast(kind: SyntaxKind) -> bool {2274 match kind {2275 FOR_SPEC | IF_SPEC => true,2276 _ => false,2277 }2278 }2279 fn cast(syntax: SyntaxNode) -> Option<Self> {2280 let res = match syntax.kind() {2281 FOR_SPEC => CompSpec::ForSpec(ForSpec { syntax }),2282 IF_SPEC => CompSpec::IfSpec(IfSpec { syntax }),2283 _ => return None,2284 };2285 Some(res)2286 }2287 fn syntax(&self) -> &SyntaxNode {2288 match self {2289 CompSpec::ForSpec(it) => &it.syntax,2290 CompSpec::IfSpec(it) => &it.syntax,2291 }2292 }2293}2294impl From<BindDestruct> for Bind {2295 fn from(node: BindDestruct) -> Bind {2296 Bind::BindDestruct(node)2297 }2298}2299impl From<BindFunction> for Bind {2300 fn from(node: BindFunction) -> Bind {2301 Bind::BindFunction(node)2302 }2303}2304impl AstNode for Bind {2305 fn can_cast(kind: SyntaxKind) -> bool {2306 match kind {2307 BIND_DESTRUCT | BIND_FUNCTION => true,2308 _ => false,2309 }2310 }2311 fn cast(syntax: SyntaxNode) -> Option<Self> {2312 let res = match syntax.kind() {2313 BIND_DESTRUCT => Bind::BindDestruct(BindDestruct { syntax }),2314 BIND_FUNCTION => Bind::BindFunction(BindFunction { syntax }),2315 _ => return None,2316 };2317 Some(res)2318 }2319 fn syntax(&self) -> &SyntaxNode {2320 match self {2321 Bind::BindDestruct(it) => &it.syntax,2322 Bind::BindFunction(it) => &it.syntax,2323 }2324 }2325}2326impl From<MemberBindStmt> for Member {2327 fn from(node: MemberBindStmt) -> Member {2328 Member::MemberBindStmt(node)2329 }2330}2331impl From<MemberAssertStmt> for Member {2332 fn from(node: MemberAssertStmt) -> Member {2333 Member::MemberAssertStmt(node)2334 }2335}2336impl From<MemberField> for Member {2337 fn from(node: MemberField) -> Member {2338 Member::MemberField(node)2339 }2340}2341impl AstNode for Member {2342 fn can_cast(kind: SyntaxKind) -> bool {2343 match kind {2344 MEMBER_BIND_STMT | MEMBER_ASSERT_STMT | MEMBER_FIELD => true,2345 _ => false,2346 }2347 }2348 fn cast(syntax: SyntaxNode) -> Option<Self> {2349 let res = match syntax.kind() {2350 MEMBER_BIND_STMT => Member::MemberBindStmt(MemberBindStmt { syntax }),2351 MEMBER_ASSERT_STMT => Member::MemberAssertStmt(MemberAssertStmt { syntax }),2352 MEMBER_FIELD => Member::MemberField(MemberField { syntax }),2353 _ => return None,2354 };2355 Some(res)2356 }2357 fn syntax(&self) -> &SyntaxNode {2358 match self {2359 Member::MemberBindStmt(it) => &it.syntax,2360 Member::MemberAssertStmt(it) => &it.syntax,2361 Member::MemberField(it) => &it.syntax,2362 }2363 }2364}2365impl From<FieldNormal> for Field {2366 fn from(node: FieldNormal) -> Field {2367 Field::FieldNormal(node)2368 }2369}2370impl From<FieldMethod> for Field {2371 fn from(node: FieldMethod) -> Field {2372 Field::FieldMethod(node)2373 }2374}2375impl AstNode for Field {2376 fn can_cast(kind: SyntaxKind) -> bool {2377 match kind {2378 FIELD_NORMAL | FIELD_METHOD => true,2379 _ => false,2380 }2381 }2382 fn cast(syntax: SyntaxNode) -> Option<Self> {2383 let res = match syntax.kind() {2384 FIELD_NORMAL => Field::FieldNormal(FieldNormal { syntax }),2385 FIELD_METHOD => Field::FieldMethod(FieldMethod { syntax }),2386 _ => return None,2387 };2388 Some(res)2389 }2390 fn syntax(&self) -> &SyntaxNode {2391 match self {2392 Field::FieldNormal(it) => &it.syntax,2393 Field::FieldMethod(it) => &it.syntax,2394 }2395 }2396}2397impl From<FieldNameFixed> for FieldName {2398 fn from(node: FieldNameFixed) -> FieldName {2399 FieldName::FieldNameFixed(node)2400 }2401}2402impl From<FieldNameDynamic> for FieldName {2403 fn from(node: FieldNameDynamic) -> FieldName {2404 FieldName::FieldNameDynamic(node)2405 }2406}2407impl AstNode for FieldName {2408 fn can_cast(kind: SyntaxKind) -> bool {2409 match kind {2410 FIELD_NAME_FIXED | FIELD_NAME_DYNAMIC => true,2411 _ => false,2412 }2413 }2414 fn cast(syntax: SyntaxNode) -> Option<Self> {2415 let res = match syntax.kind() {2416 FIELD_NAME_FIXED => FieldName::FieldNameFixed(FieldNameFixed { syntax }),2417 FIELD_NAME_DYNAMIC => FieldName::FieldNameDynamic(FieldNameDynamic { syntax }),2418 _ => return None,2419 };2420 Some(res)2421 }2422 fn syntax(&self) -> &SyntaxNode {2423 match self {2424 FieldName::FieldNameFixed(it) => &it.syntax,2425 FieldName::FieldNameDynamic(it) => &it.syntax,2426 }2427 }2428}2429impl From<DestructFull> for Destruct {2430 fn from(node: DestructFull) -> Destruct {2431 Destruct::DestructFull(node)2432 }2433}2434impl From<DestructSkip> for Destruct {2435 fn from(node: DestructSkip) -> Destruct {2436 Destruct::DestructSkip(node)2437 }2438}2439impl From<DestructArray> for Destruct {2440 fn from(node: DestructArray) -> Destruct {2441 Destruct::DestructArray(node)2442 }2443}2444impl From<DestructObject> for Destruct {2445 fn from(node: DestructObject) -> Destruct {2446 Destruct::DestructObject(node)2447 }2448}2449impl AstNode for Destruct {2450 fn can_cast(kind: SyntaxKind) -> bool {2451 match kind {2452 DESTRUCT_FULL | DESTRUCT_SKIP | DESTRUCT_ARRAY | DESTRUCT_OBJECT => true,2453 _ => false,2454 }2455 }2456 fn cast(syntax: SyntaxNode) -> Option<Self> {2457 let res = match syntax.kind() {2458 DESTRUCT_FULL => Destruct::DestructFull(DestructFull { syntax }),2459 DESTRUCT_SKIP => Destruct::DestructSkip(DestructSkip { syntax }),2460 DESTRUCT_ARRAY => Destruct::DestructArray(DestructArray { syntax }),2461 DESTRUCT_OBJECT => Destruct::DestructObject(DestructObject { syntax }),2462 _ => return None,2463 };2464 Some(res)2465 }2466 fn syntax(&self) -> &SyntaxNode {2467 match self {2468 Destruct::DestructFull(it) => &it.syntax,2469 Destruct::DestructSkip(it) => &it.syntax,2470 Destruct::DestructArray(it) => &it.syntax,2471 Destruct::DestructObject(it) => &it.syntax,2472 }2473 }2474}2475impl From<DestructArrayElement> for DestructArrayPart {2476 fn from(node: DestructArrayElement) -> DestructArrayPart {2477 DestructArrayPart::DestructArrayElement(node)2478 }2479}2480impl From<DestructRest> for DestructArrayPart {2481 fn from(node: DestructRest) -> DestructArrayPart {2482 DestructArrayPart::DestructRest(node)2483 }2484}2485impl AstNode for DestructArrayPart {2486 fn can_cast(kind: SyntaxKind) -> bool {2487 match kind {2488 DESTRUCT_ARRAY_ELEMENT | DESTRUCT_REST => true,2489 _ => false,2490 }2491 }2492 fn cast(syntax: SyntaxNode) -> Option<Self> {2493 let res = match syntax.kind() {2494 DESTRUCT_ARRAY_ELEMENT => {2495 DestructArrayPart::DestructArrayElement(DestructArrayElement { syntax })2496 }2497 DESTRUCT_REST => DestructArrayPart::DestructRest(DestructRest { syntax }),2498 _ => return None,2499 };2500 Some(res)2501 }2502 fn syntax(&self) -> &SyntaxNode {2503 match self {2504 DestructArrayPart::DestructArrayElement(it) => &it.syntax,2505 DestructArrayPart::DestructRest(it) => &it.syntax,2506 }2507 }2508}2509impl AstToken for BinaryOperator {2510 fn can_cast(kind: SyntaxKind) -> bool {2511 match kind {2512 OR | AND | BIT_OR | BIT_XOR | BIT_AND | EQ | NE | LT | GT | LE | GE | IN_KW | LHS2513 | RHS | PLUS | MINUS | MUL | DIV | MODULO | ERROR_NO_OPERATOR => true,2514 _ => false,2515 }2516 }2517 fn cast(syntax: SyntaxToken) -> Option<Self> {2518 let res = match syntax.kind() {2519 OR => BinaryOperator {2520 syntax,2521 kind: BinaryOperatorKind::Or,2522 },2523 AND => BinaryOperator {2524 syntax,2525 kind: BinaryOperatorKind::And,2526 },2527 BIT_OR => BinaryOperator {2528 syntax,2529 kind: BinaryOperatorKind::BitOr,2530 },2531 BIT_XOR => BinaryOperator {2532 syntax,2533 kind: BinaryOperatorKind::BitXor,2534 },2535 BIT_AND => BinaryOperator {2536 syntax,2537 kind: BinaryOperatorKind::BitAnd,2538 },2539 EQ => BinaryOperator {2540 syntax,2541 kind: BinaryOperatorKind::Eq,2542 },2543 NE => BinaryOperator {2544 syntax,2545 kind: BinaryOperatorKind::Ne,2546 },2547 LT => BinaryOperator {2548 syntax,2549 kind: BinaryOperatorKind::Lt,2550 },2551 GT => BinaryOperator {2552 syntax,2553 kind: BinaryOperatorKind::Gt,2554 },2555 LE => BinaryOperator {2556 syntax,2557 kind: BinaryOperatorKind::Le,2558 },2559 GE => BinaryOperator {2560 syntax,2561 kind: BinaryOperatorKind::Ge,2562 },2563 IN_KW => BinaryOperator {2564 syntax,2565 kind: BinaryOperatorKind::InKw,2566 },2567 LHS => BinaryOperator {2568 syntax,2569 kind: BinaryOperatorKind::Lhs,2570 },2571 RHS => BinaryOperator {2572 syntax,2573 kind: BinaryOperatorKind::Rhs,2574 },2575 PLUS => BinaryOperator {2576 syntax,2577 kind: BinaryOperatorKind::Plus,2578 },2579 MINUS => BinaryOperator {2580 syntax,2581 kind: BinaryOperatorKind::Minus,2582 },2583 MUL => BinaryOperator {2584 syntax,2585 kind: BinaryOperatorKind::Mul,2586 },2587 DIV => BinaryOperator {2588 syntax,2589 kind: BinaryOperatorKind::Div,2590 },2591 MODULO => BinaryOperator {2592 syntax,2593 kind: BinaryOperatorKind::Modulo,2594 },2595 ERROR_NO_OPERATOR => BinaryOperator {2596 syntax,2597 kind: BinaryOperatorKind::ErrorNoOperator,2598 },2599 _ => return None,2600 };2601 Some(res)2602 }2603 fn syntax(&self) -> &SyntaxToken {2604 &self.syntax2605 }2606}2607impl BinaryOperator {2608 pub fn kind(&self) -> BinaryOperatorKind {2609 self.kind2610 }2611}2612impl std::fmt::Display for BinaryOperator {2613 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2614 std::fmt::Display::fmt(self.syntax(), f)2615 }2616}2617impl AstToken for UnaryOperator {2618 fn can_cast(kind: SyntaxKind) -> bool {2619 match kind {2620 MINUS | NOT | BIT_NOT => true,2621 _ => false,2622 }2623 }2624 fn cast(syntax: SyntaxToken) -> Option<Self> {2625 let res = match syntax.kind() {2626 MINUS => UnaryOperator {2627 syntax,2628 kind: UnaryOperatorKind::Minus,2629 },2630 NOT => UnaryOperator {2631 syntax,2632 kind: UnaryOperatorKind::Not,2633 },2634 BIT_NOT => UnaryOperator {2635 syntax,2636 kind: UnaryOperatorKind::BitNot,2637 },2638 _ => return None,2639 };2640 Some(res)2641 }2642 fn syntax(&self) -> &SyntaxToken {2643 &self.syntax2644 }2645}2646impl UnaryOperator {2647 pub fn kind(&self) -> UnaryOperatorKind {2648 self.kind2649 }2650}2651impl std::fmt::Display for UnaryOperator {2652 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2653 std::fmt::Display::fmt(self.syntax(), f)2654 }2655}2656impl AstToken for Literal {2657 fn can_cast(kind: SyntaxKind) -> bool {2658 match kind {2659 NULL_KW | TRUE_KW | FALSE_KW | SELF_KW | DOLLAR | SUPER_KW => true,2660 _ => false,2661 }2662 }2663 fn cast(syntax: SyntaxToken) -> Option<Self> {2664 let res = match syntax.kind() {2665 NULL_KW => Literal {2666 syntax,2667 kind: LiteralKind::NullKw,2668 },2669 TRUE_KW => Literal {2670 syntax,2671 kind: LiteralKind::TrueKw,2672 },2673 FALSE_KW => Literal {2674 syntax,2675 kind: LiteralKind::FalseKw,2676 },2677 SELF_KW => Literal {2678 syntax,2679 kind: LiteralKind::SelfKw,2680 },2681 DOLLAR => Literal {2682 syntax,2683 kind: LiteralKind::Dollar,2684 },2685 SUPER_KW => Literal {2686 syntax,2687 kind: LiteralKind::SuperKw,2688 },2689 _ => return None,2690 };2691 Some(res)2692 }2693 fn syntax(&self) -> &SyntaxToken {2694 &self.syntax2695 }2696}2697impl Literal {2698 pub fn kind(&self) -> LiteralKind {2699 self.kind2700 }2701}2702impl std::fmt::Display for Literal {2703 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2704 std::fmt::Display::fmt(self.syntax(), f)2705 }2706}2707impl AstToken for Text {2708 fn can_cast(kind: SyntaxKind) -> bool {2709 match kind {2710 STRING_DOUBLE2711 | ERROR_STRING_DOUBLE_UNTERMINATED2712 | STRING_SINGLE2713 | ERROR_STRING_SINGLE_UNTERMINATED2714 | STRING_DOUBLE_VERBATIM2715 | ERROR_STRING_DOUBLE_VERBATIM_UNTERMINATED2716 | STRING_SINGLE_VERBATIM2717 | ERROR_STRING_SINGLE_VERBATIM_UNTERMINATED2718 | ERROR_STRING_VERBATIM_MISSING_QUOTES2719 | STRING_BLOCK2720 | ERROR_STRING_BLOCK_UNEXPECTED_END2721 | ERROR_STRING_BLOCK_MISSING_NEW_LINE2722 | ERROR_STRING_BLOCK_MISSING_TERMINATION2723 | ERROR_STRING_BLOCK_MISSING_INDENT => true,2724 _ => false,2725 }2726 }2727 fn cast(syntax: SyntaxToken) -> Option<Self> {2728 let res = match syntax.kind() {2729 STRING_DOUBLE => Text {2730 syntax,2731 kind: TextKind::StringDouble,2732 },2733 ERROR_STRING_DOUBLE_UNTERMINATED => Text {2734 syntax,2735 kind: TextKind::ErrorStringDoubleUnterminated,2736 },2737 STRING_SINGLE => Text {2738 syntax,2739 kind: TextKind::StringSingle,2740 },2741 ERROR_STRING_SINGLE_UNTERMINATED => Text {2742 syntax,2743 kind: TextKind::ErrorStringSingleUnterminated,2744 },2745 STRING_DOUBLE_VERBATIM => Text {2746 syntax,2747 kind: TextKind::StringDoubleVerbatim,2748 },2749 ERROR_STRING_DOUBLE_VERBATIM_UNTERMINATED => Text {2750 syntax,2751 kind: TextKind::ErrorStringDoubleVerbatimUnterminated,2752 },2753 STRING_SINGLE_VERBATIM => Text {2754 syntax,2755 kind: TextKind::StringSingleVerbatim,2756 },2757 ERROR_STRING_SINGLE_VERBATIM_UNTERMINATED => Text {2758 syntax,2759 kind: TextKind::ErrorStringSingleVerbatimUnterminated,2760 },2761 ERROR_STRING_VERBATIM_MISSING_QUOTES => Text {2762 syntax,2763 kind: TextKind::ErrorStringVerbatimMissingQuotes,2764 },2765 STRING_BLOCK => Text {2766 syntax,2767 kind: TextKind::StringBlock,2768 },2769 ERROR_STRING_BLOCK_UNEXPECTED_END => Text {2770 syntax,2771 kind: TextKind::ErrorStringBlockUnexpectedEnd,2772 },2773 ERROR_STRING_BLOCK_MISSING_NEW_LINE => Text {2774 syntax,2775 kind: TextKind::ErrorStringBlockMissingNewLine,2776 },2777 ERROR_STRING_BLOCK_MISSING_TERMINATION => Text {2778 syntax,2779 kind: TextKind::ErrorStringBlockMissingTermination,2780 },2781 ERROR_STRING_BLOCK_MISSING_INDENT => Text {2782 syntax,2783 kind: TextKind::ErrorStringBlockMissingIndent,2784 },2785 _ => return None,2786 };2787 Some(res)2788 }2789 fn syntax(&self) -> &SyntaxToken {2790 &self.syntax2791 }2792}2793impl Text {2794 pub fn kind(&self) -> TextKind {2795 self.kind2796 }2797}2798impl std::fmt::Display for Text {2799 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2800 std::fmt::Display::fmt(self.syntax(), f)2801 }2802}2803impl AstToken for Number {2804 fn can_cast(kind: SyntaxKind) -> bool {2805 match kind {2806 FLOAT2807 | ERROR_FLOAT_JUNK_AFTER_POINT2808 | ERROR_FLOAT_JUNK_AFTER_EXPONENT2809 | ERROR_FLOAT_JUNK_AFTER_EXPONENT_SIGN => true,2810 _ => false,2811 }2812 }2813 fn cast(syntax: SyntaxToken) -> Option<Self> {2814 let res = match syntax.kind() {2815 FLOAT => Number {2816 syntax,2817 kind: NumberKind::Float,2818 },2819 ERROR_FLOAT_JUNK_AFTER_POINT => Number {2820 syntax,2821 kind: NumberKind::ErrorFloatJunkAfterPoint,2822 },2823 ERROR_FLOAT_JUNK_AFTER_EXPONENT => Number {2824 syntax,2825 kind: NumberKind::ErrorFloatJunkAfterExponent,2826 },2827 ERROR_FLOAT_JUNK_AFTER_EXPONENT_SIGN => Number {2828 syntax,2829 kind: NumberKind::ErrorFloatJunkAfterExponentSign,2830 },2831 _ => return None,2832 };2833 Some(res)2834 }2835 fn syntax(&self) -> &SyntaxToken {2836 &self.syntax2837 }2838}2839impl Number {2840 pub fn kind(&self) -> NumberKind {2841 self.kind2842 }2843}2844impl std::fmt::Display for Number {2845 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2846 std::fmt::Display::fmt(self.syntax(), f)2847 }2848}2849impl AstToken for ImportKind {2850 fn can_cast(kind: SyntaxKind) -> bool {2851 match kind {2852 IMPORTSTR_KW | IMPORTBIN_KW | IMPORT_KW => true,2853 _ => false,2854 }2855 }2856 fn cast(syntax: SyntaxToken) -> Option<Self> {2857 let res = match syntax.kind() {2858 IMPORTSTR_KW => ImportKind {2859 syntax,2860 kind: ImportKindKind::ImportstrKw,2861 },2862 IMPORTBIN_KW => ImportKind {2863 syntax,2864 kind: ImportKindKind::ImportbinKw,2865 },2866 IMPORT_KW => ImportKind {2867 syntax,2868 kind: ImportKindKind::ImportKw,2869 },2870 _ => return None,2871 };2872 Some(res)2873 }2874 fn syntax(&self) -> &SyntaxToken {2875 &self.syntax2876 }2877}2878impl ImportKind {2879 pub fn kind(&self) -> ImportKindKind {2880 self.kind2881 }2882}2883impl std::fmt::Display for ImportKind {2884 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2885 std::fmt::Display::fmt(self.syntax(), f)2886 }2887}2888impl AstToken for Visibility {2889 fn can_cast(kind: SyntaxKind) -> bool {2890 match kind {2891 COLONCOLONCOLON | COLONCOLON | COLON => true,2892 _ => false,2893 }2894 }2895 fn cast(syntax: SyntaxToken) -> Option<Self> {2896 let res = match syntax.kind() {2897 COLONCOLONCOLON => Visibility {2898 syntax,2899 kind: VisibilityKind::Coloncoloncolon,2900 },2901 COLONCOLON => Visibility {2902 syntax,2903 kind: VisibilityKind::Coloncolon,2904 },2905 COLON => Visibility {2906 syntax,2907 kind: VisibilityKind::Colon,2908 },2909 _ => return None,2910 };2911 Some(res)2912 }2913 fn syntax(&self) -> &SyntaxToken {2914 &self.syntax2915 }2916}2917impl Visibility {2918 pub fn kind(&self) -> VisibilityKind {2919 self.kind2920 }2921}2922impl std::fmt::Display for Visibility {2923 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2924 std::fmt::Display::fmt(self.syntax(), f)2925 }2926}2927impl AstToken for Trivia {2928 fn can_cast(kind: SyntaxKind) -> bool {2929 match kind {2930 WHITESPACE2931 | MULTI_LINE_COMMENT2932 | ERROR_COMMENT_TOO_SHORT2933 | ERROR_COMMENT_UNTERMINATED2934 | SINGLE_LINE_HASH_COMMENT2935 | SINGLE_LINE_SLASH_COMMENT => true,2936 _ => false,2937 }2938 }2939 fn cast(syntax: SyntaxToken) -> Option<Self> {2940 let res = match syntax.kind() {2941 WHITESPACE => Trivia {2942 syntax,2943 kind: TriviaKind::Whitespace,2944 },2945 MULTI_LINE_COMMENT => Trivia {2946 syntax,2947 kind: TriviaKind::MultiLineComment,2948 },2949 ERROR_COMMENT_TOO_SHORT => Trivia {2950 syntax,2951 kind: TriviaKind::ErrorCommentTooShort,2952 },2953 ERROR_COMMENT_UNTERMINATED => Trivia {2954 syntax,2955 kind: TriviaKind::ErrorCommentUnterminated,2956 },2957 SINGLE_LINE_HASH_COMMENT => Trivia {2958 syntax,2959 kind: TriviaKind::SingleLineHashComment,2960 },2961 SINGLE_LINE_SLASH_COMMENT => Trivia {2962 syntax,2963 kind: TriviaKind::SingleLineSlashComment,2964 },2965 _ => return None,2966 };2967 Some(res)2968 }2969 fn syntax(&self) -> &SyntaxToken {2970 &self.syntax2971 }2972}2973impl Trivia {2974 pub fn kind(&self) -> TriviaKind {2975 self.kind2976 }2977}2978impl std::fmt::Display for Trivia {2979 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2980 std::fmt::Display::fmt(self.syntax(), f)2981 }2982}2983impl std::fmt::Display for Expr {2984 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2985 std::fmt::Display::fmt(self.syntax(), f)2986 }2987}2988impl std::fmt::Display for ObjBody {2989 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2990 std::fmt::Display::fmt(self.syntax(), f)2991 }2992}2993impl std::fmt::Display for CompSpec {2994 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {2995 std::fmt::Display::fmt(self.syntax(), f)2996 }2997}2998impl std::fmt::Display for Bind {2999 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3000 std::fmt::Display::fmt(self.syntax(), f)3001 }3002}3003impl std::fmt::Display for Member {3004 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3005 std::fmt::Display::fmt(self.syntax(), f)3006 }3007}3008impl std::fmt::Display for Field {3009 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3010 std::fmt::Display::fmt(self.syntax(), f)3011 }3012}3013impl std::fmt::Display for FieldName {3014 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3015 std::fmt::Display::fmt(self.syntax(), f)3016 }3017}3018impl std::fmt::Display for Destruct {3019 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3020 std::fmt::Display::fmt(self.syntax(), f)3021 }3022}3023impl std::fmt::Display for DestructArrayPart {3024 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3025 std::fmt::Display::fmt(self.syntax(), f)3026 }3027}3028impl std::fmt::Display for SourceFile {3029 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3030 std::fmt::Display::fmt(self.syntax(), f)3031 }3032}3033impl std::fmt::Display for ExprBinary {3034 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3035 std::fmt::Display::fmt(self.syntax(), f)3036 }3037}3038impl std::fmt::Display for LhsExpr {3039 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3040 std::fmt::Display::fmt(self.syntax(), f)3041 }3042}3043impl std::fmt::Display for ExprUnary {3044 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3045 std::fmt::Display::fmt(self.syntax(), f)3046 }3047}3048impl std::fmt::Display for ExprSlice {3049 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3050 std::fmt::Display::fmt(self.syntax(), f)3051 }3052}3053impl std::fmt::Display for SliceDesc {3054 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3055 std::fmt::Display::fmt(self.syntax(), f)3056 }3057}3058impl std::fmt::Display for ExprIndex {3059 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3060 std::fmt::Display::fmt(self.syntax(), f)3061 }3062}3063impl std::fmt::Display for Name {3064 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3065 std::fmt::Display::fmt(self.syntax(), f)3066 }3067}3068impl std::fmt::Display for ExprIndexExpr {3069 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3070 std::fmt::Display::fmt(self.syntax(), f)3071 }3072}3073impl std::fmt::Display for ExprApply {3074 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3075 std::fmt::Display::fmt(self.syntax(), f)3076 }3077}3078impl std::fmt::Display for ArgsDesc {3079 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3080 std::fmt::Display::fmt(self.syntax(), f)3081 }3082}3083impl std::fmt::Display for ExprObjExtend {3084 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3085 std::fmt::Display::fmt(self.syntax(), f)3086 }3087}3088impl std::fmt::Display for ExprParened {3089 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3090 std::fmt::Display::fmt(self.syntax(), f)3091 }3092}3093impl std::fmt::Display for ExprLiteral {3094 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3095 std::fmt::Display::fmt(self.syntax(), f)3096 }3097}3098impl std::fmt::Display for ExprIntrinsicThisFile {3099 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3100 std::fmt::Display::fmt(self.syntax(), f)3101 }3102}3103impl std::fmt::Display for ExprIntrinsicId {3104 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3105 std::fmt::Display::fmt(self.syntax(), f)3106 }3107}3108impl std::fmt::Display for ExprIntrinsic {3109 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3110 std::fmt::Display::fmt(self.syntax(), f)3111 }3112}3113impl std::fmt::Display for ExprString {3114 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3115 std::fmt::Display::fmt(self.syntax(), f)3116 }3117}3118impl std::fmt::Display for ExprNumber {3119 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3120 std::fmt::Display::fmt(self.syntax(), f)3121 }3122}3123impl std::fmt::Display for ExprArray {3124 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3125 std::fmt::Display::fmt(self.syntax(), f)3126 }3127}3128impl std::fmt::Display for ExprObject {3129 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3130 std::fmt::Display::fmt(self.syntax(), f)3131 }3132}3133impl std::fmt::Display for ExprArrayComp {3134 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3135 std::fmt::Display::fmt(self.syntax(), f)3136 }3137}3138impl std::fmt::Display for ExprImport {3139 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3140 std::fmt::Display::fmt(self.syntax(), f)3141 }3142}3143impl std::fmt::Display for ExprVar {3144 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3145 std::fmt::Display::fmt(self.syntax(), f)3146 }3147}3148impl std::fmt::Display for ExprLocal {3149 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3150 std::fmt::Display::fmt(self.syntax(), f)3151 }3152}3153impl std::fmt::Display for ExprIfThenElse {3154 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3155 std::fmt::Display::fmt(self.syntax(), f)3156 }3157}3158impl std::fmt::Display for TrueExpr {3159 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3160 std::fmt::Display::fmt(self.syntax(), f)3161 }3162}3163impl std::fmt::Display for FalseExpr {3164 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3165 std::fmt::Display::fmt(self.syntax(), f)3166 }3167}3168impl std::fmt::Display for ExprFunction {3169 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3170 std::fmt::Display::fmt(self.syntax(), f)3171 }3172}3173impl std::fmt::Display for ParamsDesc {3174 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3175 std::fmt::Display::fmt(self.syntax(), f)3176 }3177}3178impl std::fmt::Display for ExprAssert {3179 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3180 std::fmt::Display::fmt(self.syntax(), f)3181 }3182}3183impl std::fmt::Display for Assertion {3184 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3185 std::fmt::Display::fmt(self.syntax(), f)3186 }3187}3188impl std::fmt::Display for ExprError {3189 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3190 std::fmt::Display::fmt(self.syntax(), f)3191 }3192}3193impl std::fmt::Display for SliceDescEnd {3194 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3195 std::fmt::Display::fmt(self.syntax(), f)3196 }3197}3198impl std::fmt::Display for SliceDescStep {3199 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3200 std::fmt::Display::fmt(self.syntax(), f)3201 }3202}3203impl std::fmt::Display for Arg {3204 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3205 std::fmt::Display::fmt(self.syntax(), f)3206 }3207}3208impl std::fmt::Display for ObjBodyComp {3209 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3210 std::fmt::Display::fmt(self.syntax(), f)3211 }3212}3213impl std::fmt::Display for ObjLocalPostComma {3214 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3215 std::fmt::Display::fmt(self.syntax(), f)3216 }3217}3218impl std::fmt::Display for ObjLocalPreComma {3219 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3220 std::fmt::Display::fmt(self.syntax(), f)3221 }3222}3223impl std::fmt::Display for ObjBodyMemberList {3224 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3225 std::fmt::Display::fmt(self.syntax(), f)3226 }3227}3228impl std::fmt::Display for ObjLocal {3229 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3230 std::fmt::Display::fmt(self.syntax(), f)3231 }3232}3233impl std::fmt::Display for MemberBindStmt {3234 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3235 std::fmt::Display::fmt(self.syntax(), f)3236 }3237}3238impl std::fmt::Display for MemberAssertStmt {3239 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3240 std::fmt::Display::fmt(self.syntax(), f)3241 }3242}3243impl std::fmt::Display for MemberField {3244 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3245 std::fmt::Display::fmt(self.syntax(), f)3246 }3247}3248impl std::fmt::Display for FieldNormal {3249 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3250 std::fmt::Display::fmt(self.syntax(), f)3251 }3252}3253impl std::fmt::Display for FieldMethod {3254 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3255 std::fmt::Display::fmt(self.syntax(), f)3256 }3257}3258impl std::fmt::Display for FieldNameFixed {3259 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3260 std::fmt::Display::fmt(self.syntax(), f)3261 }3262}3263impl std::fmt::Display for FieldNameDynamic {3264 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3265 std::fmt::Display::fmt(self.syntax(), f)3266 }3267}3268impl std::fmt::Display for ForSpec {3269 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3270 std::fmt::Display::fmt(self.syntax(), f)3271 }3272}3273impl std::fmt::Display for IfSpec {3274 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3275 std::fmt::Display::fmt(self.syntax(), f)3276 }3277}3278impl std::fmt::Display for BindDestruct {3279 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3280 std::fmt::Display::fmt(self.syntax(), f)3281 }3282}3283impl std::fmt::Display for BindFunction {3284 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3285 std::fmt::Display::fmt(self.syntax(), f)3286 }3287}3288impl std::fmt::Display for Param {3289 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3290 std::fmt::Display::fmt(self.syntax(), f)3291 }3292}3293impl std::fmt::Display for DestructFull {3294 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3295 std::fmt::Display::fmt(self.syntax(), f)3296 }3297}3298impl std::fmt::Display for DestructSkip {3299 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3300 std::fmt::Display::fmt(self.syntax(), f)3301 }3302}3303impl std::fmt::Display for DestructArray {3304 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3305 std::fmt::Display::fmt(self.syntax(), f)3306 }3307}3308impl std::fmt::Display for DestructObject {3309 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3310 std::fmt::Display::fmt(self.syntax(), f)3311 }3312}3313impl std::fmt::Display for DestructObjectField {3314 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3315 std::fmt::Display::fmt(self.syntax(), f)3316 }3317}3318impl std::fmt::Display for DestructRest {3319 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3320 std::fmt::Display::fmt(self.syntax(), f)3321 }3322}3323impl std::fmt::Display for DestructArrayElement {3324 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {3325 std::fmt::Display::fmt(self.syntax(), f)3326 }3327}