-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathparser.go
More file actions
43 lines (34 loc) · 1.02 KB
/
parser.go
File metadata and controls
43 lines (34 loc) · 1.02 KB
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
// Implements a binary parsing system.
package vtypes
import (
"io"
"github.com/Velocidex/ordereddict"
"www.velocidex.com/golang/vfilter"
)
// Parsers are objects which know how to parse a particular
// type. Parsers are instantiated once and reused many times.
type Parser interface {
Parse(scope vfilter.Scope, reader io.ReaderAt, offset int64) interface{}
// Given options, this returns a new configured parser
New(profile *Profile, options *ordereddict.Dict) (Parser, error)
}
// Used by parsers or wrappers who have fixed size
type Sizer interface {
Size() int
}
// Applies on a parser which needs to instantiate to figure out the
// size. i.e. the size depends on the data read (e.g. a string).
type InstanceSizer interface {
InstanceSize(scope vfilter.Scope, reader io.ReaderAt, offset int64) int
}
// Allows psuedo elements to reveal their own value.
type Valuer interface {
Value() interface{}
}
// Return the start and end of the object
type Starter interface {
Start() int64
}
type Ender interface {
End() int64
}