// Create looks for identifier in symboltable and creates a pointer if missing. func (s *SymbolTable) Create(q *ast.QuestionNode) { identifier := q.Identifier() label := q.Label() qType := q.Type() pos := q.Pos() primitive := q.Primitive() _, ok := s.symbolExistP(identifier) if ok { s.appendErrf("%s:symboltable error: duplicated identifier found at symbol table: %s", pos, identifier) return } var symbol interface{} switch qType { case ast.ScalarQuestionType: newSymbol, err := scalarQuestionFactory(primitive) if err != nil { s.appendErrf("%s:symboltable error: %s", pos, err.Error()) } symbol = newSymbol case ast.ComputedQuestionType: symbol = new(ComputedQuestion) } s.upsert(identifier, symbol) s.detectRepeatedLabel(identifier, label) }