cirql

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package cirql is the covered seam over the generated ANTLR parser: it turns a cirql query string into a typed ast.Pipeline and any syntax error into the ErrParse sentinel. The generated lexer/parser live in src/grammar/cirql and are never edited by hand.

Index

Constants

View Source
const ErrParse errs.Const = "cirql: parse error"

ErrParse is returned for any lexer or parser syntax error; the wrap adds the source position and the underlying message.

View Source
const ErrQueryTooLarge errs.Const = "cirql: query too large"

ErrQueryTooLarge is returned when a query exceeds MaxQueryBytes. The bound exists because the generated recursive-descent parser recurses per nesting level, so a deeply nested adversarial query (e.g. hundreds of thousands of parentheses) would overflow the goroutine stack — an uncatchable fatal error, not a panic. Bounding the query length caps nesting depth well below that, and a cirql query is bounded DSL text (the DATA arrives on stdin, never in the query), so the limit never constrains a real query.

View Source
const MaxQueryBytes = 256 * 1024

MaxQueryBytes bounds a query's length. The generated parser recurses once per nesting level, so an unbounded query could overflow the goroutine stack (an uncatchable fatal error). 256 KiB caps nesting far below that limit while dwarfing any real query — query text is DSL, not data (data arrives on stdin), so this never constrains legitimate use.

Variables

This section is empty.

Functions

func Parse

func Parse(query Query) (ast.Pipeline, error)

Parse turns a cirql query into a Pipeline AST, or ErrParse on a syntax error. A query longer than MaxQueryBytes is rejected with ErrQueryTooLarge before parsing, so adversarial deep nesting cannot overflow the stack.

Types

type Query

type Query string

Query is the raw text of a cirql query.

Jump to

Keyboard shortcuts

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