parsers

package
v0.0.0-...-0af058b Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

AllParser is a multi-parser that uses all of the default parsers

AllParsers is an array with all of the default parsers

Functions

func CleanTypeName

func CleanTypeName(s string) string

CleanTypeName will remove leading and trailing whitespace and leading asterisks.

func ParseAssets

func ParseAssets(input Input) (ParserResult, Input)

ParseAssets will parse an asset listing

func ParseCargoScan

func ParseCargoScan(input Input) (ParserResult, Input)

ParseCargoScan parses cargo scans

func ParseCompare

func ParseCompare(input Input) (ParserResult, Input)

ParseCompare will parse an compare window

func ParseContract

func ParseContract(input Input) (ParserResult, Input)

ParseContract parses a contract

func ParseDScan

func ParseDScan(input Input) (ParserResult, Input)

ParseDScan parses a d-scan

func ParseEFT

func ParseEFT(input Input) (ParserResult, Input)

ParseEFT parses EFT text

func ParseFitting

func ParseFitting(input Input) (ParserResult, Input)

ParseFitting parses fittings

func ParseIndustry

func ParseIndustry(input Input) (ParserResult, Input)

ParseIndustry parses industry window text

func ParseKillmail

func ParseKillmail(input Input) (ParserResult, Input)

ParseKillmail parses a killmail

func ParseListing

func ParseListing(input Input) (ParserResult, Input)

ParseListing parses a list of eve items

func ParseLootHistory

func ParseLootHistory(input Input) (ParserResult, Input)

ParseLootHistory parses loot history text

func ParseMiningLedger

func ParseMiningLedger(input Input) (ParserResult, Input)

ParseMiningLedger will parse a mining ledger

func ParseMoonLedger

func ParseMoonLedger(input Input) (ParserResult, Input)

ParseMoonLedger will parse a mining ledger

func ParsePI

func ParsePI(input Input) (ParserResult, Input)

ParsePI parses text from the planetary interaction screens

func ParseSurveyScan

func ParseSurveyScan(input Input) (ParserResult, Input)

ParseSurveyScan parses text from a the survey scan screen

func ParseViewContents

func ParseViewContents(input Input) (ParserResult, Input)

ParseViewContents parses view contents text

func ParseWallet

func ParseWallet(input Input) (ParserResult, Input)

ParseWallet parses wallet text

func ToFloat64

func ToFloat64(s string) float64

ToFloat64 parses a string into a float64. It will return 0.0 on failure

func ToInt

func ToInt(s string) int64

ToInt parses a string into an integer. It will return 0 on failure

Types

type AssetItem

type AssetItem struct {
	Name          string
	Quantity      int64
	Volume        float64
	Group         string
	Category      string
	Size          string
	Slot          string
	MetaLevel     string
	TechLevel     string
	PriceEstimate float64
}

AssetItem is a single item parsed from an asset list

type AssetList

type AssetList struct {
	Items []AssetItem
	// contains filtered or unexported fields
}

AssetList is the result from the asset parser

func (*AssetList) Lines

func (r *AssetList) Lines() []int

Lines returns the lines that this result is made from

func (*AssetList) Name

func (r *AssetList) Name() string

Name returns the parser name

type CargoScan

type CargoScan struct {
	Items []CargoScanItem
	// contains filtered or unexported fields
}

CargoScan is the result from the cargo scan parser

func (CargoScan) Lines

func (r CargoScan) Lines() []int

Lines returns the lines that this result is made from

func (CargoScan) Name

func (r CargoScan) Name() string

Name returns the parser name

type CargoScanItem

type CargoScanItem struct {
	Name     string
	Quantity int64
	BPC      bool
}

CargoScanItem is a single item from a cargo scan result

type Compare

type Compare struct {
	Items []CompareItem
	// contains filtered or unexported fields
}

Compare is the result from the asset parser

func (*Compare) Lines

func (r *Compare) Lines() []int

Lines returns the lines that this result is made from

func (*Compare) Name

func (r *Compare) Name() string

Name returns the parser name

type CompareItem

type CompareItem struct {
	Name string
}

CompareItem is a single item parsed from an asset list

type ContextListingParser

type ContextListingParser struct {
	// contains filtered or unexported fields
}

ContextListingParser is a parser which uses the typeDB to help parse a listing

func (*ContextListingParser) Parse

func (p *ContextListingParser) Parse(input Input) (ParserResult, Input)

Parse parses a listing

type Contract

type Contract struct {
	Items []ContractItem
	// contains filtered or unexported fields
}

Contract is the result from the contract parser

func (*Contract) Lines

func (r *Contract) Lines() []int

Lines returns the lines that this result is made from

func (*Contract) Name

func (r *Contract) Name() string

Name returns the parser name

type ContractItem

type ContractItem struct {
	Name     string
	Quantity int64
	Type     string
	Category string
	Details  string
	Fitted   bool
	BPC      bool
	BPCRuns  int64
}

ContractItem is a single item from a contract result

type DScan

type DScan struct {
	Items []DScanItem
	// contains filtered or unexported fields
}

DScan is the result from the cargo scan parser

func (*DScan) Lines

func (r *DScan) Lines() []int

Lines returns the lines that this result is made from

func (*DScan) Name

func (r *DScan) Name() string

Name returns the parser name

type DScanItem

type DScanItem struct {
	Name         string
	Distance     float64
	DistanceUnit string
}

DScanItem is a single item from a dscan result

type EFT

type EFT struct {
	FittingName string
	Ship        string
	Items       []ListingItem
	// contains filtered or unexported fields
}

EFT is the result from the EFT parser

func (*EFT) Lines

func (r *EFT) Lines() []int

Lines returns the lines that this result is made from

func (*EFT) Name

func (r *EFT) Name() string

Name returns the parser name

type Fitting

type Fitting struct {
	Items []ListingItem
	// contains filtered or unexported fields
}

Fitting is the result from the fitting parser

func (*Fitting) Lines

func (r *Fitting) Lines() []int

Lines returns the lines that this result is made from

func (*Fitting) Name

func (r *Fitting) Name() string

Name returns the parser name

type HeuristicItem

type HeuristicItem struct {
	Name     string
	Quantity int64
}

HeuristicItem is a single item from a the heuristic result

type HeuristicParser

type HeuristicParser struct {
	// contains filtered or unexported fields
}

HeuristicParser is a parser that tries several strategies to parse out items and quantities from the given text. This is different from other parsers because it accesses the TypeDB

func (*HeuristicParser) Parse

func (p *HeuristicParser) Parse(input Input) (ParserResult, Input)

Parse is the actual parse function for the HeuristicParser

type HeuristicResult

type HeuristicResult struct {
	Items []HeuristicItem
	// contains filtered or unexported fields
}

HeuristicResult is the result from the heuristic parser

func (*HeuristicResult) Lines

func (r *HeuristicResult) Lines() []int

Lines returns the lines that this result is made from

func (*HeuristicResult) Name

func (r *HeuristicResult) Name() string

Name returns the parser name

type Industry

type Industry struct {
	Items []IndustryItem
	// contains filtered or unexported fields
}

Industry is the result from the industry parser

func (*Industry) Lines

func (r *Industry) Lines() []int

Lines returns the lines that this result is made from

func (*Industry) Name

func (r *Industry) Name() string

Name returns the parser name

type IndustryItem

type IndustryItem struct {
	Name     string
	Quantity int64
	BPC      bool
	BPCRuns  int64
}

IndustryItem is a single item from an industry result

type Input

type Input map[int]string

Input is used as the input to parsers. This exists so that the first part of parsing the text isn't duplicated for each parser

func StringToInput

func StringToInput(s string) Input

StringToInput converts a strings into an Input object

func StringsToInput

func StringsToInput(lines []string) Input

StringsToInput converts an array of strings into an Input object

func (Input) String

func (m Input) String() string

String returns a string from an Input object

func (Input) Strings

func (m Input) Strings() []string

Strings returns an array of strings from an Input object

type Killmail

type Killmail struct {
	Datetime  string
	Victim    map[string]interface{}
	Involved  []map[string]interface{}
	Destroyed []KillmailItem
	Dropped   []KillmailItem
	// contains filtered or unexported fields
}

Killmail is the result from the killmail parser

func (*Killmail) Lines

func (r *Killmail) Lines() []int

Lines returns the lines that this result is made from

func (*Killmail) Name

func (r *Killmail) Name() string

Name returns the parser name

type KillmailItem

type KillmailItem struct {
	Name     string
	Quantity int64
	Location string
}

KillmailItem is a single item from a killmail result

type Listing

type Listing struct {
	Items []ListingItem
	// contains filtered or unexported fields
}

Listing is the result from the listing parser

func (*Listing) Lines

func (r *Listing) Lines() []int

Lines returns the lines that this result is made from

func (*Listing) Name

func (r *Listing) Name() string

Name returns the parser name

type ListingItem

type ListingItem struct {
	Name     string
	Quantity int64
}

ListingItem is a single item from a listing result

type LootHistory

type LootHistory struct {
	Items []LootItem
	// contains filtered or unexported fields
}

LootHistory is the result from the loot history parser

func (*LootHistory) Lines

func (r *LootHistory) Lines() []int

Lines returns the lines that this result is made from

func (*LootHistory) Name

func (r *LootHistory) Name() string

Name returns the parser name

type LootItem

type LootItem struct {
	Time       string
	Name       string
	PlayerName string
	Quantity   int64
}

LootItem is a single item from a loot history result

type MiningLedger

type MiningLedger struct {
	Items []MiningLedgerItem
	// contains filtered or unexported fields
}

MiningLedger is the result from the mining ledger parser

func (*MiningLedger) Lines

func (r *MiningLedger) Lines() []int

Lines returns the lines that this result is made from

func (*MiningLedger) Name

func (r *MiningLedger) Name() string

Name returns the parser name

type MiningLedgerItem

type MiningLedgerItem struct {
	Name     string
	Quantity int64
}

MiningLedgerItem is a single item from a mining ledger result

type MoonLedger

type MoonLedger struct {
	Items []MoonLedgerItem
	// contains filtered or unexported fields
}

MoonLedger is the result from the mining ledger parser

func (*MoonLedger) Lines

func (r *MoonLedger) Lines() []int

Lines returns the lines that this result is made from

func (*MoonLedger) Name

func (r *MoonLedger) Name() string

Name returns the parser name

type MoonLedgerItem

type MoonLedgerItem struct {
	PlayerName string
	Name       string
	Quantity   int64
}

MoonLedgerItem is a single item from a mining ledger result

type MultiParserResult

type MultiParserResult struct {
	Results []ParserResult
}

MultiParserResult is the result from the multi-parser

func (*MultiParserResult) Lines

func (r *MultiParserResult) Lines() []int

Lines returns the lines that this result is made from

func (*MultiParserResult) Name

func (r *MultiParserResult) Name() string

Name returns the parser name

type PI

type PI struct {
	Items []PIItem
	// contains filtered or unexported fields
}

PI is the result from the planetary interaction parser

func (*PI) Lines

func (r *PI) Lines() []int

Lines returns the lines that this result is made from

func (*PI) Name

func (r *PI) Name() string

Name returns the parser name

type PIItem

type PIItem struct {
	Name     string
	Quantity int64
	Volume   float64
	Routed   bool
}

PIItem is a single item from a planetary interaction result

type Parser

type Parser func(input Input) (ParserResult, Input)

Parser is the interface that every parser implements

func NewContextListingParser

func NewContextListingParser(typeDB typedb.TypeDB) Parser

NewContextListingParser returns a new listing (w/context) parser

func NewHeuristicParser

func NewHeuristicParser(typeDB typedb.TypeDB) Parser

NewHeuristicParser returns a new HeuristicParser given a typeDB

func NewMultiParser

func NewMultiParser(parsers []Parser) Parser

NewMultiParser returns a new MultiParser that uses all of the given parses in order of preference

type ParserResult

type ParserResult interface {
	// Name is the name of the PARSER that yielded this result
	Name() string
	Lines() []int
}

ParserResult is the interface of the result that every parser returns

type ScanItem

type ScanItem struct {
	Name     string
	Quantity int64
	Distance string
}

ScanItem is a single item from a cargo scan result

type SurveyScan

type SurveyScan struct {
	Items []ScanItem
	// contains filtered or unexported fields
}

SurveyScan is the result from the survey scan parser

func (*SurveyScan) Lines

func (r *SurveyScan) Lines() []int

Lines returns the lines that this result is made from

func (*SurveyScan) Name

func (r *SurveyScan) Name() string

Name returns the parser name

type ViewContents

type ViewContents struct {
	Items []ViewContentsItem
	// contains filtered or unexported fields
}

ViewContents is the result from the view contents parser

func (*ViewContents) Lines

func (r *ViewContents) Lines() []int

Lines returns the lines that this result is made from

func (*ViewContents) Name

func (r *ViewContents) Name() string

Name returns the parser name

type ViewContentsItem

type ViewContentsItem struct {
	Name     string
	Group    string
	Location string
	Quantity int64
}

ViewContentsItem is a single item from a view contents result

type Wallet

type Wallet struct {
	Transactions         []WalletTransaction
	ItemizedTransactions []WalletItemizedTransaction
	// contains filtered or unexported fields
}

Wallet is the result from the wallet parser

func (*Wallet) Lines

func (r *Wallet) Lines() []int

Lines returns the lines that this result is made from

func (*Wallet) Name

func (r *Wallet) Name() string

Name returns the parser name

type WalletItemizedTransaction

type WalletItemizedTransaction struct {
	Datetime string
	Name     string
	Price    string
	Quantity int64
	Credit   string
	Currency string
	Client   string
	Location string
}

WalletItemizedTransaction is an itemized transaction line from a wallet log

type WalletTransaction

type WalletTransaction struct {
	Datetime        string
	TransactionType string
	Amount          string
	Balance         string
	Description     string
}

WalletTransaction is a transaction line from a wallet log

Jump to

Keyboard shortcuts

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