Пример #1
0
// NewUnaryOp .
func NewUnaryOp(token lexer.TokenType, operand Expr) *UnaryOp {
	lit := &UnaryOp{
		Token:   token,
		Operand: operand,
	}

	lit._init(token.String())

	return lit
}
Пример #2
0
// NewBinaryOp .
func NewBinaryOp(token lexer.TokenType, lhs, rhs Expr) *BinaryOp {
	lit := &BinaryOp{
		Token: token,
		LHS:   lhs,
		RHS:   rhs,
	}

	lit._init(token.String())

	return lit
}