gitee.com/yfmps/gopher-lua@v0.0.3/ast/expr.go (about)

     1  package ast
     2  
     3  type Expr interface {
     4  	PositionHolder
     5  	exprMarker()
     6  }
     7  
     8  type ExprBase struct {
     9  	Node
    10  }
    11  
    12  func (expr *ExprBase) exprMarker() {}
    13  
    14  /* ConstExprs {{{ */
    15  
    16  type ConstExpr interface {
    17  	Expr
    18  	constExprMarker()
    19  }
    20  
    21  type ConstExprBase struct {
    22  	ExprBase
    23  }
    24  
    25  func (expr *ConstExprBase) constExprMarker() {}
    26  
    27  type TrueExpr struct {
    28  	ConstExprBase
    29  }
    30  
    31  type FalseExpr struct {
    32  	ConstExprBase
    33  }
    34  
    35  type NilExpr struct {
    36  	ConstExprBase
    37  }
    38  
    39  type NumberExpr struct {
    40  	ConstExprBase
    41  
    42  	Value string
    43  }
    44  
    45  type StringExpr struct {
    46  	ConstExprBase
    47  
    48  	Value string
    49  }
    50  
    51  /* ConstExprs }}} */
    52  
    53  type Comma3Expr struct {
    54  	ExprBase
    55  }
    56  
    57  type IdentExpr struct {
    58  	ExprBase
    59  
    60  	Value string
    61  }
    62  
    63  type AttrGetExpr struct {
    64  	ExprBase
    65  
    66  	Object Expr
    67  	Key    Expr
    68  }
    69  
    70  type TableExpr struct {
    71  	ExprBase
    72  
    73  	Fields []*Field
    74  }
    75  
    76  type FuncCallExpr struct {
    77  	ExprBase
    78  
    79  	Func      Expr
    80  	Receiver  Expr
    81  	Method    string
    82  	Args      []Expr
    83  	AdjustRet bool
    84  }
    85  
    86  type LogicalOpExpr struct {
    87  	ExprBase
    88  
    89  	Operator string
    90  	Lhs      Expr
    91  	Rhs      Expr
    92  }
    93  
    94  type RelationalOpExpr struct {
    95  	ExprBase
    96  
    97  	Operator string
    98  	Lhs      Expr
    99  	Rhs      Expr
   100  }
   101  
   102  type StringConcatOpExpr struct {
   103  	ExprBase
   104  
   105  	Lhs Expr
   106  	Rhs Expr
   107  }
   108  
   109  type ArithmeticOpExpr struct {
   110  	ExprBase
   111  
   112  	Operator string
   113  	Lhs      Expr
   114  	Rhs      Expr
   115  }
   116  
   117  type UnaryMinusOpExpr struct {
   118  	ExprBase
   119  	Expr Expr
   120  }
   121  
   122  type UnaryNotOpExpr struct {
   123  	ExprBase
   124  	Expr Expr
   125  }
   126  
   127  type UnaryLenOpExpr struct {
   128  	ExprBase
   129  	Expr Expr
   130  }
   131  
   132  type FunctionExpr struct {
   133  	ExprBase
   134  
   135  	ParList *ParList
   136  	Stmts   []Stmt
   137  }