Documentation
¶
Index ¶
Constants ¶
View Source
const ( QuoteTypeNone = iota QuoteTypeSingle QuoteTypeDouble )
Variables ¶
This section is empty.
Functions ¶
func IsGenericError ¶
IsGenericError checks if the error is a GenericError.
Types ¶
type GenericError ¶
type GenericError struct {
Err error `json:"error"`
Line int `json:"line"`
Column int `json:"column"`
}
GenericError is a generic error that can be returned by the lexer.
func (*GenericError) Error ¶
func (e *GenericError) Error() string
func (*GenericError) Unwrap ¶
func (e *GenericError) Unwrap() error
type Reference ¶
type Reference struct {
Token Token // Token that represents the literal.
Position int // Character position of the token in the input.
Line int // Line number of the token in the input.
Column int // Column number of the token in the input.
Value string // Literal value of the token.
QuoteType QuoteType // Type of quote used, if any.
}
Reference represents a reference to a token in the input, and the associated context.
type StatefulLexer ¶
type StatefulLexer struct {
// contains filtered or unexported fields
}
StatefulLexer is a lexer that maintains state between calls to [Iter], and only applies specific idents when applicable. We keep this state/context validation mostly because dot env files are pretty loose, and can be written in a variety of ways with very little strictness.
func New ¶
func New(input string) *StatefulLexer
New creates a new StatefulLexer. Note that all windows-style carriage returns are converted to newlines.
Click to show internal directories.
Click to hide internal directories.