parseutil

package
v1.3.11-0...-c80e787 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2025 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

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

func CtxErrorStr

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

func CtxString

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

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

Returned line/col values are one-based.

func IsQuoted

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

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

func RemoveEscapes

func RemoveEscapes(str string, escape rune) string

func RemoveEscapes2

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

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

func SurroundingString

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

func ToLowerNoAccents

func ToLowerNoAccents(b []byte) []byte

func ToLowerNoAccents2

func ToLowerNoAccents2(s string) string

func TrimLineSpaces

func TrimLineSpaces(str string) string

Useful to compare src code lines.

func TrimLineSpaces2

func TrimLineSpaces2(str string, pre string) string

func UnquoteString

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

removes escapes runes (keeping the escaped) if quoted

func UnquoteStringBs

func UnquoteStringBs(s string) (string, error)

unquote string with backslash as escape

func UrlToAbsFilename

func UrlToAbsFilename(url2 string) (string, error)

func VersionLessThan

func VersionLessThan(a, b string) bool

func VersionOrdinal

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

func (fp *FilePos) HasNoLinecol() bool

func (*FilePos) HasPos

func (fp *FilePos) HasPos() bool

Directories

Path Synopsis
wrapgen command

Jump to

Keyboard shortcuts

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