scanner

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	MaxStringLength int64
	MaxArrayDepth   int
	MaxDictDepth    int
	MaxStreamLength int64
	MaxStreamScan   int64
	MaxInlineImage  int64
	MaxNameLength   int64
	MaxNumberLength int
	WindowSize      int64
	MaxBufferSize   int64
	Recovery        recovery.Strategy
}

type ReaderAt

type ReaderAt interface {
	ReadAt(p []byte, off int64) (n int, err error)
}

type Scanner

type Scanner interface {
	Next() (Token, error)
	Position() int64
	SeekTo(offset int64) error
	SetNextStreamLength(n int64)
}

func New

func New(r ReaderAt, cfg Config) Scanner

New loads entire ReaderAt into memory and returns a scanner.

type Token

type Token struct {
	Type  TokenType
	Pos   int64
	Str   string
	Bytes []byte
	Int   int64
	Gen   int
	Float float64
	Bool  bool
	IsInt bool
}

func (Token) Value

func (t Token) Value() interface{}

type TokenType

type TokenType int
const (
	TokenDict        TokenType = iota // '<<'
	TokenArray                        // '['
	TokenName                         // '/Name'
	TokenString                       // literal or hex string
	TokenNumber                       // numeric value
	TokenBoolean                      // true/false
	TokenNull                         // null
	TokenRef                          // indirect ref '5 0 R'
	TokenStream                       // 'stream' keyword
	TokenInlineImage                  // inline image data following ID ... EI (content stream only)
	TokenKeyword                      // other keywords (obj, endobj, endstream, >>, ], etc.)
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL