Skip to main content

Crate pasta_dsl

Crate pasta_dsl 

Source
Expand description

Pasta DSL - Independent DSL parser and AST definitions.

This crate provides a standalone parser for the Pasta DSL (Domain Specific Language), enabling DSL parsing without depending on any specific backend (Lua, etc.) or runtime.

§Features

  • PEG-based parser: Uses Pest 2.8 for grammar-driven parsing
  • Complete AST: Full AST type definitions for all Pasta DSL constructs
  • Independent error types: ParseError and ParseErrorInfo for parse diagnostics
  • Zero backend dependency: No Lua, registry, or runtime dependencies

§Example

use pasta_dsl::parser::{parse_str, FileItem, PastaFile};

let source = "*挨拶\n  Alice:こんにちは\n";
let ast = parse_str(source, "test.pasta").unwrap();

let scene_count = ast.items.iter()
    .filter(|i| matches!(i, FileItem::GlobalSceneScope(_)))
    .count();
println!("Parsed {} global scenes", scene_count);

Re-exports§

pub use error::ParseError;
pub use error::ParseErrorInfo;
pub use error::ParseResult;
pub use parser::FileItem;
pub use parser::PastaFile;
pub use parser::parse_file;
pub use parser::parse_str;
pub use partial::PartialParseError;
pub use partial::PartialParseResult;
pub use partial::parse_str_partial;

Modules§

error
Error types for Pasta DSL parsing layer.
parser
Parser module for Pasta DSL using the grammar.pest grammar.
partial
Partial parse support for Pasta DSL.