// VisitForm creates the top level questions in the form's inner body
func (this *GUI) VisitForm(f interfaces.Form, context interface{}) interface{} {
	guiQuestions := handleQuestions(this, f.Questions())

	this.registerOnShowCallback(func() {
		this.GUIForm.addQuestionContainer(this.GUIForm.createQuestionTable(guiQuestions))
	})

	return nil
}
// conductTypeChecking starts type checking the passed form for errors and warnings
func conductTypeChecking(form interfaces.Form) ([]error, []error) {
	typeChecker := typechecker.NewTypeChecker()
	typeCheckerArgs := typechecker.NewTypeCheckArgs(typeChecker, symbols.NewTypeCheckSymbols())
	form.TypeCheck(&typeCheckerArgs)
	warnings := typeChecker.EncounteredWarnings()
	errors := typeChecker.EncounteredErrors()

	log.WithFields(log.Fields{"errors": errors, "warnings": warnings}).Error("Type checking finished")

	return errors, warnings
}
func testStmtParse(t *testing.T, stmtAsString string, formFixture interfaces.Form) stmt.Form {
	lex := lexer.NewLexer([]byte(stmtAsString))
	parser := parser.NewParser()
	parseResult, err := parser.Parse(lex)

	if err != nil {
		t.Fatalf("Encountered fatal error during parse: %s", err)
	}

	if parsedForn, parseResultIsForm := parseResult.(stmt.Form); parseResultIsForm {
		if firstFormIdentifier, secondFormIdentifier := parsedForn.Identifier(), formFixture.Identifier(); firstFormIdentifier != secondFormIdentifier {
			t.Errorf("Form identifiers not equal: %s and %s", firstFormIdentifier, secondFormIdentifier)
		}

		if !util.AreStmtListsEqual(parsedForn.Content(), formFixture.Content()) {
			t.Errorf("Form content not equal: %v and %v", parsedForn, formFixture)
		}
	} else {
		t.Fatalf("Parse result is not form")
	}

	return parseResult.(stmt.Form)
}
func (suite *TypeCheckerTestSuite) typeCheckPassedFormAndReturnErrors(form interfaces.Form) ([]error, []error) {
	form.TypeCheck(suite.typeCheckArgs)
	return suite.typeCheckArgs.TypeChecker().EncounteredErrors(), suite.typeCheckArgs.TypeChecker().EncounteredWarnings()
}
func (this *DefaultVarIDValueVisitor) StartSettingDefaultValuesForVarIDs(form interfaces.Form) *VarIDValueSymbols {
	varIDValueSymbols := NewVarIDValueSymbols()
	form.Accept(this, varIDValueSymbols)

	return varIDValueSymbols
}
func (this *GUI) InitializeGUIForm(form interfaces.Form, symbols interfaces.VarIDValueSymbols) {
	this.setSymbols(symbols)
	this.createAndSetGUIFormFromForm(form)

	form.Accept(this, this.Symbols)
}