renpy_parser

Crates.iorenpy_parser
lib.rsrenpy_parser
version0.0.3
sourcesrc
created_at2024-11-05 16:42:40.114157
updated_at2024-11-10 17:48:35.862871
descriptionParse renpy script files with Rust
homepage
repositoryhttps://github.com/stillonearth/renpy-rs
max_upload_size
id1436790
size200,405
Sergei Surovtsev (stillonearth)

documentation

README

renpy_parser_rs

Ren'Py Scenario File Parser in Rust (translated from Ren'Py's parser.py)

This parser handles a subset of the Ren'Py scripting language, excluding support for variables, expressions, and Python code.

Supported keywords:

  • "hide"
  • "init"
  • "jump"
  • "return"
  • "scene"
  • "show"
  • "stop"

Usage

use renpy_parser::{group_logical_lines, lexer::Lexer, list_logical_lines, parsers::parse_block};

fn main() {
    let lines = list_logical_lines("assets/script.rpy").unwrap();
    let blocks = group_logical_lines(lines).unwrap();
    let l = &mut Lexer::new(blocks.clone(), true);
    let (asts, errors) = parse_block(l);
    for ast in asts {
        println!("ast: {:?}", ast);
    }
}
Commit count: 14

cargo fmt