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