github.com/mattn/anko@v0.1.10/ast/stmt.go (about) 1 package ast 2 3 // Stmt provides all of interfaces for statement. 4 type Stmt interface { 5 Pos 6 } 7 8 // StmtImpl provide commonly implementations for Stmt.. 9 type StmtImpl struct { 10 PosImpl // PosImpl provide Pos() function. 11 } 12 13 // StmtsStmt provides statements. 14 type StmtsStmt struct { 15 StmtImpl 16 Stmts []Stmt 17 } 18 19 // ExprStmt provide expression statement. 20 type ExprStmt struct { 21 StmtImpl 22 Expr Expr 23 } 24 25 // IfStmt provide "if/else" statement. 26 type IfStmt struct { 27 StmtImpl 28 If Expr 29 Then Stmt 30 ElseIf []Stmt // This is array of IfStmt 31 Else Stmt 32 } 33 34 // TryStmt provide "try/catch/finally" statement. 35 type TryStmt struct { 36 StmtImpl 37 Try Stmt 38 Var string 39 Catch Stmt 40 Finally Stmt 41 } 42 43 // ForStmt provide "for in" expression statement. 44 type ForStmt struct { 45 StmtImpl 46 Vars []string 47 Value Expr 48 Stmt Stmt 49 } 50 51 // CForStmt provide C-style "for (;;)" expression statement. 52 type CForStmt struct { 53 StmtImpl 54 Stmt1 Stmt 55 Expr2 Expr 56 Expr3 Expr 57 Stmt Stmt 58 } 59 60 // LoopStmt provide "for expr" expression statement. 61 type LoopStmt struct { 62 StmtImpl 63 Expr Expr 64 Stmt Stmt 65 } 66 67 // BreakStmt provide "break" expression statement. 68 type BreakStmt struct { 69 StmtImpl 70 } 71 72 // ContinueStmt provide "continue" expression statement. 73 type ContinueStmt struct { 74 StmtImpl 75 } 76 77 // ReturnStmt provide "return" expression statement. 78 type ReturnStmt struct { 79 StmtImpl 80 Exprs []Expr 81 } 82 83 // ThrowStmt provide "throw" expression statement. 84 type ThrowStmt struct { 85 StmtImpl 86 Expr Expr 87 } 88 89 // ModuleStmt provide "module" expression statement. 90 type ModuleStmt struct { 91 StmtImpl 92 Name string 93 Stmt Stmt 94 } 95 96 // SwitchStmt provide switch statement. 97 type SwitchStmt struct { 98 StmtImpl 99 Expr Expr 100 Cases []Stmt 101 Default Stmt 102 } 103 104 // SwitchCaseStmt provide switch case statement. 105 type SwitchCaseStmt struct { 106 StmtImpl 107 Exprs []Expr 108 Stmt Stmt 109 } 110 111 // VarStmt provide statement to let variables in current scope. 112 type VarStmt struct { 113 StmtImpl 114 Names []string 115 Exprs []Expr 116 } 117 118 // LetsStmt provide multiple statement of let. 119 type LetsStmt struct { 120 StmtImpl 121 LHSS []Expr 122 RHSS []Expr 123 } 124 125 // LetMapItemStmt provide statement of let for map item. 126 type LetMapItemStmt struct { 127 StmtImpl 128 LHSS []Expr 129 RHS Expr 130 } 131 132 // GoroutineStmt provide statement of groutine. 133 type GoroutineStmt struct { 134 StmtImpl 135 Expr Expr 136 } 137 138 // DeleteStmt provides statement of delete. 139 type DeleteStmt struct { 140 ExprImpl 141 Item Expr 142 Key Expr 143 } 144 145 // CloseStmt provides statement of close. 146 type CloseStmt struct { 147 StmtImpl 148 Expr Expr 149 } 150 151 // ChanStmt provide chan lets statement. 152 type ChanStmt struct { 153 ExprImpl 154 LHS Expr 155 OkExpr Expr 156 RHS Expr 157 }