parseutil

package
v1.3.8 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ExtraRunes = "_-~.%@&?!=#+:^" + "(){}[]<>" + "\\/" + " "

Functions

func AbsFilenameToUrl

func AbsFilenameToUrl(filename string) (string, error)

func AddEscapes

func AddEscapes(str string, escape rune, escapeRunes string) string

func CleanMultiplePathSeps

func CleanMultiplePathSeps(str string, sep rune) string

func ContainsRune added in v1.3.7

func ContainsRune(rs []rune, ru rune) bool

func CtxErrorStr added in v1.3.3

func CtxErrorStr(rd iorw.ReaderAt, filename string, pos int, msg string, contextSize int) string

func CtxString added in v1.3.3

func CtxString(rd iorw.ReaderAt, pos int, contextSize int) (string, error)

func DetectEnvVar

func DetectEnvVar(str, name string) bool

func EscapeFilename

func EscapeFilename(str string) string

func ExpandIndexEscape

func ExpandIndexEscape(r iorw.ReaderAt, i int, truth bool, fn func(rune) bool, escape rune) int

func ExpandIndexesEscape

func ExpandIndexesEscape(rd iorw.ReaderAt, index int, truth bool, fn func(rune) bool, escape rune) (int, int)

func ExpandLastIndexEscape

func ExpandLastIndexEscape(r iorw.ReaderAt, i int, truth bool, fn func(rune) bool, escape rune) int

func ImproveExpandIndexEscape

func ImproveExpandIndexEscape(r iorw.ReaderAt, i int, escape rune) int

func IndexLineColumn

func IndexLineColumn(rd iorw.ReaderAt, index int) (int, int, error)

Returned line/col values are one-based.

func IndexLineColumn2 added in v1.3.7

func IndexLineColumn2(b []byte, index int) (int, int)

Returned line/col values are one-based.

func IsQuoted added in v1.3.7

func IsQuoted(s string) bool

func LineColumnIndex

func LineColumnIndex(rd iorw.ReaderAt, line, column int) (int, error)

Line/col args are one-based.

func ParseFields added in v1.3.1

func ParseFields(s string, fieldSep rune) ([]string, error)

func RemoveEscapes

func RemoveEscapes(str string, escape rune) string

func RemoveEscapes2 added in v1.3.7

func RemoveEscapes2(rs []rune, escapable []rune, escape rune) []rune

func RemoveEscapesEscapable

func RemoveEscapesEscapable(str string, escape rune, escapable string) string

func RemoveFilenameEscapes

func RemoveFilenameEscapes(f string, escape, pathSep rune) string

func RunesExcept

func RunesExcept(runes, except string) string

func RunesQuote added in v1.3.7

func RunesQuote(rs []rune) (rune, error)

func SurroundingString added in v1.3.7

func SurroundingString(b []byte, k int, pad int) string

func ToLowerNoAccents added in v1.3.7

func ToLowerNoAccents(b []byte) []byte

func ToLowerNoAccents2 added in v1.3.7

func ToLowerNoAccents2(s string) string

func TrimLineSpaces

func TrimLineSpaces(str string) string

Useful to compare src code lines.

func TrimLineSpaces2 added in v1.3.1

func TrimLineSpaces2(str string, pre string) string

func UnquoteString added in v1.3.7

func UnquoteString(s string, esc rune) (string, error)

removes escapes runes (keeping the escaped) if quoted

func UnquoteStringBs added in v1.3.7

func UnquoteStringBs(s string) (string, error)

unquote string with backslash as escape

func UrlToAbsFilename

func UrlToAbsFilename(url2 string) (string, error)

func VersionLessThan added in v1.3.1

func VersionLessThan(a, b string) bool

func VersionOrdinal added in v1.3.1

func VersionOrdinal(version string) string

constructs a byte array (returned as a string) with the count of sequential digits to be able to compare "1.9"<"1.10"

Types

type FilePos

type FilePos struct {
	Filename     string
	Offset, Len  int // length after offset for a range
	Line, Column int // bigger than zero to be considered
}

func (*FilePos) HasNoLinecol added in v1.3.8

func (fp *FilePos) HasNoLinecol() bool

func (*FilePos) HasPos added in v1.3.8

func (fp *FilePos) HasPos() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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