Skip to main content

Crate dbt_antlr_codegen

Crate dbt_antlr_codegen 

Source
Expand description

ANTLR v4 grammar compiler and Rust source generator for the dbt-antlr-runtime runtime.

The emission layer renders recognizers from the minijinja template templates/dbt/Rust.stg.jinja on top of the grammar analysis in grammar. There are two ways to run a generation:

  • Config: the build-script API. Add this crate as a build dependency and call it from build.rs; the generated code compiles against the dbt-antlr-runtime crate. No tool installation is needed.
  • The dbt-antlr-codegen binary: the Java-tool-like command line for one-shot or checked-in generation.

§Crate features

  • generator (default): the in-process grammar compiler and emission layer. Disable it to use this crate as a thin client.
  • download: enables Config::pinned_release, which downloads and runs a pinned prebuilt release binary instead of compiling the generator.
  • fancy (default): pretty miette diagnostics for the command line.
  • atn-export: internal, for this workspace’s own tests.

Modules§

atn_export
Compiled ATN data export, available with the atn-export feature.
cli
Command-line interface of the dbt emission layer, mirroring the Java ANTLR tool’s argument syntax:
emission
Emission layer generating Rust recognizers for the dbt-antlr-runtime runtime.

Structs§

Config
Generator configuration, primarily for use from a build.rs build script.
Diagnostic
A grammar compiler diagnostic.
Error
Structured error returned by the emission entry points.
Generation
Files and non-fatal output of Config::generate_detailed.
OptimizationOptions
Optimization selection for one generation run.

Enums§

EmitError
Errors of the emission layer.
ErrorKind
Broad category of a generator failure.
Severity
Severity of one grammar diagnostic.

Constants§

VERSION
Version of this generator package.