package ast import ( "github.com/d5/tengo/compiler/source" ) // CondExpr represents a ternary conditional expression. type CondExpr struct { Cond Expr True Expr False Expr QuestionPos source.Pos ColonPos source.Pos } func (e *CondExpr) exprNode() {} // Pos returns the position of first character belonging to the node. func (e *CondExpr) Pos() source.Pos { return e.Cond.Pos() } // End returns the position of first character immediately after the node. func (e *CondExpr) End() source.Pos { return e.False.End() } func (e *CondExpr) String() string { return "(" + e.Cond.String() + " ? " + e.True.String() + " : " + e.False.String() + ")" }