codeparse

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2025 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FuncTypeString = "String"
	FuncTypeWrite  = "Write"
)

Variables

View Source
var (
	ErrUnsupportedSelectOption    = errors.New("unsupported select option")
	ErrCantUnpackCompositeLiteral = errors.New("can't unpack composite literal")
)

Functions

func HashMessage

func HashMessage(hash *xxhash.Digest, tik string) string

func ICUSelectOptions added in v0.3.1

func ICUSelectOptions(argName string) (
	[]string, icumsg.OptionsPresencePolicy, icumsg.OptionUnknownPolicy,
)

func IsMsgIncomplete added in v0.2.3

func IsMsgIncomplete(
	scan *Scan, arbFile *arb.File, fileName string, msg *arb.Message,
) bool

Types

type Catalog

type Catalog struct {
	CatalogStatistics
	ARB         *arb.File
	ARBFilePath string
}

type CatalogStatistics

type CatalogStatistics struct {
	MessagesIncomplete atomic.Int64
}

type FnOnSrcErr

type FnOnSrcErr func(pos token.Position, err error)

type Parser

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

func NewParser

func NewParser(
	hasher *xxhash.Digest,
	tikParser *tik.Parser,
	translatorICU *tik.ICUTranslator,
) *Parser

func (*Parser) CollectARBFiles added in v0.8.0

func (p *Parser) CollectARBFiles(bundlePkgDir string, scan *Scan) error

func (*Parser) Parse

func (p *Parser) Parse(
	env []string, pathPattern, bundlePkgPath string, trimpath bool,
) (scan *Scan, err error)

type Scan

type Scan struct {
	Statistics
	TokiVersion   string
	DefaultLocale language.Tag
	Texts         *sync.Slice[Text]
	TextIndexByID *sync.Map[string, int]
	SourceErrors  *sync.Slice[SourceError]
	Catalogs      *sync.Slice[*Catalog]
}

func NewScan added in v0.8.0

func NewScan(defaultLocale language.Tag, tokiVersion string) *Scan

type SourceError

type SourceError struct {
	token.Position
	Err error
}

type Statistics

type Statistics struct {
	StringCalls    atomic.Int64
	WriteCalls     atomic.Int64
	FilesTraversed atomic.Int64
}

type Text

type Text struct {
	Position token.Position
	TIK      tik.TIK
	IDHash   string
	Comments []string
}

func (Text) Context

func (t Text) Context() string

Jump to

Keyboard shortcuts

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