aboutsummaryrefslogtreecommitdiff
path: root/tvloader/parser2v1/types.go
blob: 8f3cf23827d3a3cf5e7789cca07ebf3ab099a8cf (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
// SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later

package parser2v1

import (
	"github.com/spdx/tools-golang/spdx/common"
	"github.com/spdx/tools-golang/spdx/v2_1"
)

type tvParser2_1 struct {
	// document into which data is being parsed
	doc *v2_1.Document

	// current parser state
	st tvParserState2_1

	// current SPDX item being filled in, if any
	pkg       *v2_1.Package
	pkgExtRef *v2_1.PackageExternalReference
	file      *v2_1.File
	fileAOP   *v2_1.ArtifactOfProject
	snippet   *v2_1.Snippet
	otherLic  *v2_1.OtherLicense
	rln       *v2_1.Relationship
	ann       *v2_1.Annotation
	rev       *v2_1.Review
	// don't need creation info pointer b/c only one,
	// and we can get to it via doc.CreationInfo
}

// parser state (SPDX document version 2.1)
type tvParserState2_1 int

const (
	// at beginning of document
	psStart2_1 tvParserState2_1 = iota

	// in document creation info section
	psCreationInfo2_1

	// in package data section
	psPackage2_1

	// in file data section (including "unpackaged" files)
	psFile2_1

	// in snippet data section (including "unpackaged" files)
	psSnippet2_1

	// in other license section
	psOtherLicense2_1

	// in review section
	psReview2_1
)

const nullSpdxElementId2_1 = common.ElementID("")