parser

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package parser implements a DDL parser for SQLite schemas.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Diagnostic

type Diagnostic struct {
	Path     string
	Line     int
	Column   int
	Message  string
	Severity Severity
}

Diagnostic captures parser feedback for callers to display.

func Parse

func Parse(path string, tokens []tokenizer.Token) (*model.Catalog, []Diagnostic, error)

Parse constructs a catalog from the provided tokens, collecting diagnostics.

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

Parser consumes tokenizer output and produces a normalized catalog.

type SchemaParser

type SchemaParser interface {
	Parse(ctx context.Context, path string, content []byte) (*model.Catalog, []Diagnostic, error)
}

SchemaParser parses SQL DDL statements and produces a schema catalog.

func NewSchemaParser

func NewSchemaParser(dialect string) (SchemaParser, error)

NewSchemaParser creates a new SchemaParser for the specified dialect. Currently only "sqlite" is supported.

type Severity

type Severity int

Severity indicates diagnostic severity.

const (
	// SeverityError indicates a parsing or validation error.
	SeverityError Severity = iota
	// SeverityWarning indicates a non-fatal warning.
	SeverityWarning
)

Jump to

Keyboard shortcuts

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