func NewIfElseNode(cond attrib, ifBody attrib, elseBody attrib, sourcePosInfo attrib) (interfaces.IfElse, error) { stmt := stmt.NewIfElse(cond.(interfaces.Expr), ifBody.(stmt.StmtList), elseBody.(stmt.StmtList)) stmt.SetSourceInfo(sourcePosInfo.(token.Pos)) return stmt, nil }
func NewEmptyStmtListNode(sourcePosInfo attrib) (interfaces.StmtList, error) { stmt := stmt.NewEmptyStmtList() stmt.SetSourceInfo(sourcePosInfo.(token.Pos)) return stmt, nil }
func NewStmtListNode(stmtElt attrib) (interfaces.StmtList, error) { stmtEltTypeAsserted := stmtElt.(interfaces.Stmt) stmt := stmt.NewEmptyStmtList() stmt.SetSourceInfo(stmtEltTypeAsserted.SourceInfo()) return stmt.AddStmt(stmtEltTypeAsserted), nil }
func NewComputedQuestionNode(label attrib, varDecl attrib, computation attrib, sourcePosInfo attrib) (interfaces.ComputedQuestion, error) { stmt := stmt.NewComputedQuestion(label.(expr.StringLiteral), varDecl.(vari.VarDecl), computation.(interfaces.Expr)) stmt.SetSourceInfo(sourcePosInfo.(token.Pos)) return stmt, nil }
func NewInputQuestionNode(label attrib, varDecl attrib) (interfaces.InputQuestion, error) { labelStringLiteral := label.(expr.StringLiteral) stmt := stmt.NewInputQuestion(labelStringLiteral, varDecl.(vari.VarDecl)) stmt.SetSourceInfo(labelStringLiteral.SourceInfo()) return stmt, nil }
func NewFormNode(identifier attrib, body attrib, sourcePosInfo attrib) (interfaces.Form, error) { stmt := stmt.NewForm(identifier.(vari.VarID), body.(stmt.StmtList)) stmt.SetSourceInfo(sourcePosInfo.(token.Pos)) return stmt, nil }