1// SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 2// copied from tvloader/parser2v2/types.go 3package parser2v2 4 5import ( 6 gordfParser "github.com/spdx/gordf/rdfloader/parser" 7 "github.com/spdx/tools-golang/spdx/common" 8 "github.com/spdx/tools-golang/spdx/v2_2" 9) 10 11type rdfParser2_2 struct { 12 // fields associated with gordf project which 13 // will be required by rdfloader 14 gordfParserObj *gordfParser.Parser 15 nodeStringToTriples map[string][]*gordfParser.Triple 16 17 // document into which data is being parsed 18 doc *v2_2.Document 19 20 // map of packages and files. 21 files map[common.ElementID]*v2_2.File 22 assocWithPackage map[common.ElementID]bool 23 24 // mapping of nodeStrings to parsed object to save double computation. 25 cache map[string]*nodeState 26} 27 28type Color int 29 30const ( 31 GREY Color = iota // represents that the node is being visited 32 WHITE // unvisited node 33 BLACK // visited node 34) 35 36type nodeState struct { 37 // object will be pointer to the parsed or element being parsed. 38 object interface{} 39 // color of a state represents if the node is visited/unvisited/being-visited. 40 Color Color 41} 42 43type AnyLicenseInfo interface { 44 // ToLicenseString returns the representation of license about how it will 45 // be stored in the tools-golang data model 46 ToLicenseString() string 47} 48 49type SimpleLicensingInfo struct { 50 AnyLicenseInfo 51 comment string 52 licenseID string 53 name string 54 seeAlso []string 55 example string 56} 57 58type ExtractedLicensingInfo struct { 59 SimpleLicensingInfo 60 extractedText string 61} 62 63type OrLaterOperator struct { 64 AnyLicenseInfo 65 member SimpleLicensingInfo 66} 67 68type ConjunctiveLicenseSet struct { 69 AnyLicenseInfo 70 members []AnyLicenseInfo 71} 72 73type DisjunctiveLicenseSet struct { 74 AnyLicenseInfo 75 members []AnyLicenseInfo 76} 77 78type License struct { 79 SimpleLicensingInfo 80 isOsiApproved bool 81 licenseText string 82 standardLicenseHeader string 83 standardLicenseTemplate string 84 standardLicenseHeaderTemplate string 85 isDeprecatedLicenseID bool 86 isFsfLibre bool 87} 88 89type ListedLicense struct { 90 License 91} 92 93type LicenseException struct { 94 licenseExceptionId string 95 licenseExceptionText string 96 seeAlso string // must be a valid uri 97 name string 98 example string 99 comment string 100} 101 102type WithExceptionOperator struct { 103 AnyLicenseInfo 104 member SimpleLicensingInfo 105 licenseException LicenseException 106} 107 108// custom LicenseType to provide support for licences of 109// type Noassertion, None and customLicenses 110type SpecialLicense struct { 111 AnyLicenseInfo 112 value SpecialLicenseValue 113} 114 115type SpecialLicenseValue string 116 117const ( 118 NONE SpecialLicenseValue = "NONE" 119 NOASSERTION SpecialLicenseValue = "NOASSERTION" 120) 121 122type RangeType string 123 124const ( 125 BYTE_RANGE RangeType = "byteRange" 126 LINE_RANGE RangeType = "lineRange" 127) 128