Documentation
¶
Index ¶
- Variables
- func DetectLineType(line string) common.LineType
- func FindTerminator(line string, pos int, terminator byte) int
- func GetQuoteFromValType(t ValueType) (isQuoted bool, quote byte)
- func IsLineComment(line string) bool
- type Config
- type FileParser
- type KeyData
- type Option
- type Parser
- type ValueData
- type ValueType
- type VariableData
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultConfig = &Config{ Logger: slog.Default(), IgnoreSections: false, }
Functions ¶
func DetectLineType ¶
func FindTerminator ¶
findTerminator finds the closing quote, accounting for escaping.
func GetQuoteFromValType ¶
func IsLineComment ¶
IsLineComment checks if a line is a comment (starts with # after optional spaces).
Types ¶
type FileParser ¶
func NewFileParser ¶
func (*FileParser) GetLineIdx ¶
func (p *FileParser) GetLineIdx() int64
func (*FileParser) Next ¶
func (p *FileParser) Next() (common.ParsedLine, error)
type ValueData ¶
type ValueData struct {
Raw string // The raw value including quotes if present
Content string // The actual content (without quotes)
Start int // Start position in the line
End int // End position in the line
Type ValueType // Whether the value was quoted and with what
IsTerminated bool // Whether quotes were properly closed
}
ValueData holds information about an extracted value.
type VariableData ¶
VariableData holds information about a parsed variable.
func ParseVariable ¶
func ParseVariable(line string) (VariableData, error)
ParseVariable parses a line for a variable assignment (KEY=VALUE) Returns variable data and error.
Click to show internal directories.
Click to hide internal directories.