1// SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 2 3package parser2v2 4 5import ( 6 "fmt" 7 8 "github.com/spdx/tools-golang/spdx/v2_2" 9) 10 11func (parser *tvParser2_2) parsePairFromOtherLicense2_2(tag string, value string) error { 12 switch tag { 13 // tag for creating new other license section 14 case "LicenseID": 15 parser.otherLic = &v2_2.OtherLicense{} 16 parser.doc.OtherLicenses = append(parser.doc.OtherLicenses, parser.otherLic) 17 parser.otherLic.LicenseIdentifier = value 18 case "ExtractedText": 19 parser.otherLic.ExtractedText = value 20 case "LicenseName": 21 parser.otherLic.LicenseName = value 22 case "LicenseCrossReference": 23 parser.otherLic.LicenseCrossReferences = append(parser.otherLic.LicenseCrossReferences, value) 24 case "LicenseComment": 25 parser.otherLic.LicenseComment = value 26 // for relationship tags, pass along but don't change state 27 case "Relationship": 28 parser.rln = &v2_2.Relationship{} 29 parser.doc.Relationships = append(parser.doc.Relationships, parser.rln) 30 return parser.parsePairForRelationship2_2(tag, value) 31 case "RelationshipComment": 32 return parser.parsePairForRelationship2_2(tag, value) 33 // for annotation tags, pass along but don't change state 34 case "Annotator": 35 parser.ann = &v2_2.Annotation{} 36 parser.doc.Annotations = append(parser.doc.Annotations, parser.ann) 37 return parser.parsePairForAnnotation2_2(tag, value) 38 case "AnnotationDate": 39 return parser.parsePairForAnnotation2_2(tag, value) 40 case "AnnotationType": 41 return parser.parsePairForAnnotation2_2(tag, value) 42 case "SPDXREF": 43 return parser.parsePairForAnnotation2_2(tag, value) 44 case "AnnotationComment": 45 return parser.parsePairForAnnotation2_2(tag, value) 46 // tag for going on to review section (DEPRECATED) 47 case "Reviewer": 48 parser.st = psReview2_2 49 return parser.parsePairFromReview2_2(tag, value) 50 default: 51 return fmt.Errorf("received unknown tag %v in OtherLicense section", tag) 52 } 53 54 return nil 55} 56