示例#1
0
文件: expr.go 项目: gsrpc/gslang
// NewUnaryOp .
func NewUnaryOp(token lexer.TokenType, operand Expr) *UnaryOp {
	lit := &UnaryOp{
		Token:   token,
		Operand: operand,
	}

	lit._init(token.String())

	return lit
}
示例#2
0
文件: expr.go 项目: gsrpc/gslang
// NewBinaryOp .
func NewBinaryOp(token lexer.TokenType, lhs, rhs Expr) *BinaryOp {
	lit := &BinaryOp{
		Token: token,
		LHS:   lhs,
		RHS:   rhs,
	}

	lit._init(token.String())

	return lit
}