github.com/lwq2015/gopher-lua@v0.0.1/ast/stmt.go (about)

     1  package ast
     2  
     3  type Stmt interface {
     4  	PositionHolder
     5  	stmtMarker()
     6  }
     7  
     8  type StmtBase struct {
     9  	Node
    10  }
    11  
    12  func (stmt *StmtBase) stmtMarker() {}
    13  
    14  type AssignStmt struct {
    15  	StmtBase
    16  
    17  	Lhs []Expr
    18  	Rhs []Expr
    19  }
    20  
    21  type LocalAssignStmt struct {
    22  	StmtBase
    23  
    24  	Names []string
    25  	Exprs []Expr
    26  }
    27  
    28  type FuncCallStmt struct {
    29  	StmtBase
    30  
    31  	Expr Expr
    32  }
    33  
    34  type DoBlockStmt struct {
    35  	StmtBase
    36  
    37  	Stmts []Stmt
    38  }
    39  
    40  type WhileStmt struct {
    41  	StmtBase
    42  
    43  	Condition Expr
    44  	Stmts     []Stmt
    45  }
    46  
    47  type RepeatStmt struct {
    48  	StmtBase
    49  
    50  	Condition Expr
    51  	Stmts     []Stmt
    52  }
    53  
    54  type IfStmt struct {
    55  	StmtBase
    56  
    57  	Condition Expr
    58  	Then      []Stmt
    59  	Else      []Stmt
    60  }
    61  
    62  type NumberForStmt struct {
    63  	StmtBase
    64  
    65  	Name  string
    66  	Init  Expr
    67  	Limit Expr
    68  	Step  Expr
    69  	Stmts []Stmt
    70  }
    71  
    72  type GenericForStmt struct {
    73  	StmtBase
    74  
    75  	Names []string
    76  	Exprs []Expr
    77  	Stmts []Stmt
    78  }
    79  
    80  type FuncDefStmt struct {
    81  	StmtBase
    82  
    83  	Name *FuncName
    84  	Func *FunctionExpr
    85  }
    86  
    87  type ReturnStmt struct {
    88  	StmtBase
    89  
    90  	Exprs []Expr
    91  }
    92  
    93  type BreakStmt struct {
    94  	StmtBase
    95  }