func NewIntegerTypeNode(typeTokenLit attrib) (interfaces.IntegerType, error) { token := typeTokenLit.(*token.Token) expr := expr.NewIntegerType() expr.SetSourceInfo(token.Pos) return expr, nil }
func NewStringLiteralNode(valueToken attrib) (interfaces.Expr, error) { sourcePosInfo := valueToken.(*token.Token).Pos literalString := util.StringLiteralTokensToString(valueToken.(*token.Token)) expr := expr.NewStringLiteral(literalString) expr.SetSourceInfo(sourcePosInfo) return expr, nil }
func NewIntegerLiteralNode(litValueToken attrib) (interfaces.Expr, error) { sourcePosInfo := litValueToken.(*token.Token).Pos value, err := util.IntValue(litValueToken.(*token.Token).Lit) expr := expr.NewIntegerLiteral(int(value)) expr.SetSourceInfo(sourcePosInfo) return expr, err }
func NewGEqNode(lhs attrib, rhs attrib, sourcePosInfo attrib) (interfaces.Expr, error) { expr := expr.NewGEq(lhs.(interfaces.Expr), rhs.(interfaces.Expr)) expr.SetSourceInfo(sourcePosInfo.(token.Pos)) return expr, nil }
func NewVarExprNode(identifier attrib) (interfaces.Expr, error) { varID := identifier.(vari.VarID) expr := expr.NewVarExpr(varID) expr.SetSourceInfo(varID.SourceInfo()) return expr, nil }
func NewNotNode(value attrib, sourcePosInfo attrib) (interfaces.Expr, error) { expr := expr.NewNot(value.(interfaces.Expr)) expr.SetSourceInfo(sourcePosInfo.(token.Pos)) return expr, nil }
func NewBoolLiteralNode(value bool, sourcePosInfo attrib) (interfaces.Expr, error) { expr := expr.NewBoolLiteral(value) expr.SetSourceInfo(sourcePosInfo.(token.Pos)) return expr, nil }