github.com/yuin/gopher-lua@v1.1.2-0.20231212122839-2348fd042596/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 AdjustRet bool 56 } 57 58 type IdentExpr struct { 59 ExprBase 60 61 Value string 62 } 63 64 type AttrGetExpr struct { 65 ExprBase 66 67 Object Expr 68 Key Expr 69 } 70 71 type TableExpr struct { 72 ExprBase 73 74 Fields []*Field 75 } 76 77 type FuncCallExpr struct { 78 ExprBase 79 80 Func Expr 81 Receiver Expr 82 Method string 83 Args []Expr 84 AdjustRet bool 85 } 86 87 type LogicalOpExpr struct { 88 ExprBase 89 90 Operator string 91 Lhs Expr 92 Rhs Expr 93 } 94 95 type RelationalOpExpr struct { 96 ExprBase 97 98 Operator string 99 Lhs Expr 100 Rhs Expr 101 } 102 103 type StringConcatOpExpr struct { 104 ExprBase 105 106 Lhs Expr 107 Rhs Expr 108 } 109 110 type ArithmeticOpExpr struct { 111 ExprBase 112 113 Operator string 114 Lhs Expr 115 Rhs Expr 116 } 117 118 type UnaryMinusOpExpr struct { 119 ExprBase 120 Expr Expr 121 } 122 123 type UnaryNotOpExpr struct { 124 ExprBase 125 Expr Expr 126 } 127 128 type UnaryLenOpExpr struct { 129 ExprBase 130 Expr Expr 131 } 132 133 type FunctionExpr struct { 134 ExprBase 135 136 ParList *ParList 137 Stmts []Stmt 138 }