Documentation ¶
Index ¶
- Variables
- func JsonErrorOffset64(err error) int64
- func LineContentAt[T StringLikeContent](buf T, anchor Anchor) T
- func MakeJsonFileLocationError(filename string, buf []byte, err error) error
- func MakeJsonLocationError(buf []byte, err error) error
- type Anchor
- type FileLocation
- type FileLocationError
- type Location
- type LocationError
- type Scanner
- func (scn *Scanner) Anchor() Anchor
- func (scn *Scanner) IsAnyOf(chars string) bool
- func (scn *Scanner) IsByte(c byte) bool
- func (scn *Scanner) IsByteFunc(f func(byte) bool) bool
- func (scn *Scanner) IsEOF() bool
- func (scn *Scanner) IsEOL() bool
- func (scn *Scanner) IsNextByte(offset int, c byte) bool
- func (scn *Scanner) IsNextByteFunc(offset int, f func(byte) bool) bool
- func (scn *Scanner) IsSequence(s string) bool
- func (scn *Scanner) IsWS() bool
- func (scn *Scanner) LineContentAt(anchor Anchor) string
- func (scn *Scanner) LocationAt(anchor Anchor) Location
- func (scn *Scanner) MakeErrorAt(anchor Anchor, err error) error
- func (scn *Scanner) ReadDecUint() (uint64, error)
- func (scn *Scanner) ReadHexUint() (uint64, error)
- func (scn *Scanner) ReadLineUntil(c byte) string
- func (scn *Scanner) ReadSequenceFunc(isFirst, isOther func(byte) bool) string
- func (scn *Scanner) Skip() bool
- func (scn *Scanner) SkipByte(c byte) bool
- func (scn *Scanner) SkipByteFunc(f func(byte) bool) bool
- func (scn *Scanner) SkipEOL() bool
- func (scn *Scanner) SkipSequence(s string) bool
- func (scn *Scanner) SkipWS() bool
- func (scn *Scanner) SkipWSEOL() bool
- type StringLikeContent
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrDecDigitExpected = errors.New("a valid decimal digit expected")
View Source
var ErrHexDigitExpected = errors.New("a valid hex digit expected")
Functions ¶
func JsonErrorOffset64 ¶
func LineContentAt ¶
func LineContentAt[T StringLikeContent](buf T, anchor Anchor) T
func MakeJsonLocationError ¶
Types ¶
type Anchor ¶
type Anchor struct {
// contains filtered or unexported fields
}
func CalcAnchor ¶
func CalcAnchor[T StringLikeContent](buf T) Anchor
func (*Anchor) LineNumber ¶
type FileLocation ¶
func (*FileLocation) String ¶
func (loc *FileLocation) String() string
type FileLocationError ¶
func NewFileLocationError ¶
func NewFileLocationError(fl FileLocation, err error) *FileLocationError
func (*FileLocationError) Error ¶
func (e *FileLocationError) Error() string
type Location ¶
Location specifies line:column position within a text file
- both numers are 1-indexed
- zero values are used when line or column is unknown
note: that the column number here may differ from what your text editor is showing, due to the following simplifications:
- we can't expand tabs `\t` because we don't have a clue what's the tab size is
- we can't account for zero-width and wide (double-column) characters because unicode character width lookup is outside of the scope of this library
func LocationAt ¶
func LocationAt[T StringLikeContent](buf T, anchor Anchor) Location
type LocationError ¶
func NewLocationError ¶
func NewLocationError(loc Location, err error) *LocationError
func (*LocationError) Error ¶
func (e *LocationError) Error() string
type Scanner ¶
type Scanner struct { Filepath string // contains filtered or unexported fields }
Scanner is a generic helper for scraping source code for translation strings
func NewFileScanner ¶
func NewScanner ¶
func NewScanner[T StringLikeContent](b T) *Scanner
func (*Scanner) IsNextByteFunc ¶
func (*Scanner) IsSequence ¶
func (*Scanner) LineContentAt ¶
func (*Scanner) LocationAt ¶
func (*Scanner) ReadDecUint ¶
func (*Scanner) ReadHexUint ¶
func (*Scanner) ReadLineUntil ¶
func (*Scanner) ReadSequenceFunc ¶
func (*Scanner) SkipSequence ¶
type StringLikeContent ¶
Click to show internal directories.
Click to hide internal directories.