ruprizzle-parser 0.1.0-alpha.3

Schema DSL parser for the ruprizzle ORM
Documentation

ruprizzle-parser

Crates.io docs.rs License

Grammar-driven .ruprizzle schema parser with span-preserving diagnostics.

ruprizzle-parser turns a schema.ruprizzle source string into the typed intermediate representation defined in ruprizzle-core. It is built on a PEG grammar (using pest) and produces rich, location-aware errors so that mistakes in a schema are reported at the exact line and column with actionable help text.

Responsibilities

  • Schema parsing — parse datasource, generator, model, enum, and relation declarations.
  • Lowering — convert the raw AST into the canonical ir::Schema used by the rest of the ORM.
  • Validation — enforce rules such as unique model names, valid relation arity, and supported native types.
  • Error reporting — emit structured, multi-error diagnostics with source spans and suggestions.

Example

use ruprizzle_parser::parse;

let source = r#"
    datasource db {
        provider = "sqlite"
        url      = env("DATABASE_URL")
    }

    model User {
        id    Int    @id @default(autoincrement())
        email String @unique
    }
"#;

let schema = parse("schema.ruprizzle", source).expect("valid schema");

Most users do not call the parser directly; the ruprizzle-cli and code generator handle this for you.

Keywords

orm, sql, database, parser, schema