コード例 #1
0
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
}
コード例 #2
0
func NewEmptyStmtListNode(sourcePosInfo attrib) (interfaces.StmtList, error) {
	stmt := stmt.NewEmptyStmtList()
	stmt.SetSourceInfo(sourcePosInfo.(token.Pos))
	return stmt, nil
}
コード例 #3
0
func NewStmtListNode(stmtElt attrib) (interfaces.StmtList, error) {
	stmtEltTypeAsserted := stmtElt.(interfaces.Stmt)
	stmt := stmt.NewEmptyStmtList()
	stmt.SetSourceInfo(stmtEltTypeAsserted.SourceInfo())
	return stmt.AddStmt(stmtEltTypeAsserted), nil
}
コード例 #4
0
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
}
コード例 #5
0
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
}
コード例 #6
0
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
}