Documentation
¶
Overview ¶
Package source provides source-preserving SQL lexical operations. It owns protected regions and nesting; consumers retain their own macro semantics.
Index ¶
- func CriteriaBoundary(source string) int
- func FindCodeToken(source, token string, start int) int
- func FindLastTopLevelKeyword(source, keyword string, start int) int
- func FindTopLevelKeyword(source, keyword string, start int) int
- func HasTopLevelClause(source, clause string) bool
- func IsWhitespace(value byte) bool
- func MaskLineComments(text string) string
- func ProtectedRangeAt(source string, position int) (int, int, string)
- func ProtectionAt(source string, position int) string
- func ReadGroupString(source string, start int, open, close byte) (string, int, bool)
- func SplitArgs(source string) []string
- func SplitTopLevelAlias(source string) (string, string)
- func SplitTopLevelCSV(source string) []string
- func TrimQuote(source string) string
- func TrimQuotedArgs(args []string) []string
- func ValidateStructure(text string) error
- type CodeScanner
- type Token
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CriteriaBoundary ¶
func FindCodeToken ¶
func FindLastTopLevelKeyword ¶
func FindTopLevelKeyword ¶
func HasTopLevelClause ¶
func IsWhitespace ¶
func MaskLineComments ¶
MaskLineComments preserves byte offsets and newlines while removing only executable SQL line comments. Quoted '--' remains literal content.
func ProtectedRangeAt ¶
ProtectedRangeAt returns the half-open quoted/comment span containing an offset. An empty kind means the offset is executable code or out of range.
func ProtectionAt ¶
func ReadGroupString ¶
ReadGroupString returns the delimited source and its exclusive end offset.
func SplitTopLevelAlias ¶
func SplitTopLevelCSV ¶
func TrimQuotedArgs ¶
func ValidateStructure ¶
ValidateStructure checks parentheses and protected-region closure without imposing a dialect grammar on executable expressions or template semantics.
Types ¶
type CodeScanner ¶
type CodeScanner struct {
// contains filtered or unexported fields
}
func NewCodeScanner ¶
func NewCodeScanner(source string, start int) *CodeScanner
func (*CodeScanner) Next ¶
func (s *CodeScanner) Next() (int, bool)
func (*CodeScanner) PreviousSignificant ¶
func (s *CodeScanner) PreviousSignificant() (position int, kind string)
PreviousSignificant returns the last non-whitespace, non-comment byte before the byte just returned by a successful Next. Call it before advancing again. Quoted text is significant and has a nonempty kind; -1 means no preceding text. A lazy cursor reuses the protected-region lexer and advances through preceding SQL once across lookups, for O(n) total time and O(1) space.